summaryrefslogtreecommitdiffstats
path: root/apps/workflowengine
diff options
context:
space:
mode:
authorCarl Schwan <carl@carlschwan.eu>2022-01-11 19:14:28 +0100
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>2022-01-12 09:07:31 +0000
commit1b8f9420a324e889ffae7e338d774c8f508d593f (patch)
tree6adc662116ba6a543b37b91ecf12ca8899151350 /apps/workflowengine
parentc5ea06779596cbb38b64f656180a878242a2c04d (diff)
downloadnextcloud-server-1b8f9420a324e889ffae7e338d774c8f508d593f.tar.gz
nextcloud-server-1b8f9420a324e889ffae7e338d774c8f508d593f.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.php17
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 ||