From 65b0b4b709c701760700ce2454e562db465fd047 Mon Sep 17 00:00:00 2001 From: Maxence Lange Date: Tue, 25 Apr 2023 11:28:21 -0100 Subject: [PATCH] fix internal route when using occ Signed-off-by: Maxence Lange --- lib/Service/ConfigService.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/Service/ConfigService.php b/lib/Service/ConfigService.php index d3de54f00..47e2d2906 100644 --- a/lib/Service/ConfigService.php +++ b/lib/Service/ConfigService.php @@ -761,6 +761,12 @@ public function linkToRoute(string $route, array $args): string { $path = $this->urlGenerator->linkToRoute($route, $args); if (OC::$CLI) { + // when running from the occ command, /index.php is not removed by itself + if (str_starts_with($path, '/index.php/') + && $this->config->getSystemValueString('htaccess.RewriteBase', '') !== '') { + $path = $this->config->getSystemValueString('htaccess.RewriteBase', '/') . substr($path, 11); + } + $knownPath = parse_url($this->config->getSystemValue('overwrite.cli.url'), PHP_URL_PATH); } else { $knownPath = OC::$WEBROOT;