use app href for redirection (fix #244)
Some checks failed
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
gitea-sonarqube-bot ERROR

This commit is contained in:
Simon Vieille 2023-04-14 20:58:56 +02:00
parent 2ff4fee927
commit dca727c120
Signed by: deblan
GPG key ID: 579388D585F70417

View file

@ -78,29 +78,33 @@ class AppController extends Controller
continue;
}
return $this->redirectToApp($app['id']);
return $this->redirectToApp($app, true);
}
return $this->redirectToApp('files');
}
protected function redirectToApp($appId): RedirectResponse
protected function redirectToApp($app, bool $isHref = false): RedirectResponse
{
$isIgnoreFrontController = true === OC::$server->getConfig()->getSystemValue(
'htaccess.IgnoreFrontController',
false
);
if (!$isHref) {
$isIgnoreFrontController = true === OC::$server->getConfig()->getSystemValue(
'htaccess.IgnoreFrontController',
false
);
$isFrontControllerActive = 'true' === getenv('front_controller_active');
$isFrontControllerActive = 'true' === getenv('front_controller_active');
if ($isIgnoreFrontController || $isFrontControllerActive) {
$path = '/apps/%s/';
if ($isIgnoreFrontController || $isFrontControllerActive) {
$path = '/apps/%s/';
} else {
$path = '/index.php/apps/%s/';
}
$url = $this->urlGenerator->getAbsoluteURL(sprintf($path, $app));
} else {
$path = '/index.php/apps/%s/';
$url = $app['href'];
}
$url = $this->urlGenerator->getAbsoluteURL(sprintf($path, $appId));
return new RedirectResponse($url);
}
}