diff options
author | Vincent Petry <vincent@nextcloud.com> | 2022-01-12 09:07:05 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-12 09:07:05 +0100 |
commit | 8c75fcfbb806e90f7164f94f2a095363de967d72 (patch) | |
tree | 6211d1ee9124d3d3be6c94f18fd8da355695f2fe | |
parent | 41529ec22d4cf2ca63125a22563b8cee8c94313b (diff) | |
parent | 08bf47a5de019e38754437724767f8e12076d5c0 (diff) | |
download | nextcloud-server-8c75fcfbb806e90f7164f94f2a095363de967d72.tar.gz nextcloud-server-8c75fcfbb806e90f7164f94f2a095363de967d72.zip |
Merge pull request #30609 from nextcloud/fix/noid/request-url-cli-check
Fix RequestURL check for cli commands
-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 || |