diff options
author | Carl Schwan <carl@carlschwan.eu> | 2022-01-11 19:14:28 +0100 |
---|---|---|
committer | Carl Schwan <carl@carlschwan.eu> | 2022-01-11 19:45:07 +0100 |
commit | 08bf47a5de019e38754437724767f8e12076d5c0 (patch) | |
tree | 76523d7c1e647f3b6f99abb64a4582db4df82925 /apps/workflowengine | |
parent | 796764aafd318cfeedf6d19af4551e846a40ac94 (diff) | |
download | nextcloud-server-08bf47a5de019e38754437724767f8e12076d5c0.tar.gz nextcloud-server-08bf47a5de019e38754437724767f8e12076d5c0.zip |
Fix RequestURL check for cli commands
Fix https://github.com/nextcloud/files_automatedtagging/issues/526
Fix https://github.com/nextcloud/groupfolders/issues/1855
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
Diffstat (limited to 'apps/workflowengine')
-rw-r--r-- | apps/workflowengine/lib/Check/RequestURL.php | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/apps/workflowengine/lib/Check/RequestURL.php b/apps/workflowengine/lib/Check/RequestURL.php index 03bb4889e0b..73e6a2e6ce6 100644 --- a/apps/workflowengine/lib/Check/RequestURL.php +++ b/apps/workflowengine/lib/Check/RequestURL.php @@ -27,8 +27,9 @@ use OCP\IL10N; use OCP\IRequest; class RequestURL extends AbstractStringCheck { + public const CLI = 'cli'; - /** @var string */ + /** @var ?string */ protected $url; /** @var IRequest */ @@ -49,7 +50,11 @@ class RequestURL extends AbstractStringCheck { * @return bool */ public function executeCheck($operator, $value) { - $actualValue = $this->getActualValue(); + if (\OC::$CLI) { + $actualValue = $this->url = RequestURL::CLI; + } else { + $actualValue = $this->getActualValue(); + } if (in_array($operator, ['is', '!is'])) { switch ($value) { case 'webdav': @@ -79,10 +84,10 @@ class RequestURL extends AbstractStringCheck { return $this->url; // E.g. https://localhost/nextcloud/index.php/apps/files_texteditor/ajax/loadfile } - /** - * @return bool - */ - protected function isWebDAVRequest() { + protected function isWebDAVRequest(): bool { + if ($this->url === RequestURL::CLI) { + return false; + } return substr($this->request->getScriptName(), 0 - strlen('/remote.php')) === '/remote.php' && ( $this->request->getPathInfo() === '/webdav' || strpos($this->request->getPathInfo(), '/webdav/') === 0 || |