summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2019-03-11 12:30:44 +0100
committerJoas Schilling <coding@schilljs.com>2019-03-11 12:30:44 +0100
commit4e8b033281a1ecb4bd1fd8651cd91630022e9d38 (patch)
tree02b14ffd4e9aed95519e207c221bc1d0ad59a319 /lib
parentd40b21ac815b8088a5d0b51a6d48b39ed754631a (diff)
downloadnextcloud-server-4e8b033281a1ecb4bd1fd8651cd91630022e9d38.tar.gz
nextcloud-server-4e8b033281a1ecb4bd1fd8651cd91630022e9d38.zip
Make sure urlParams are correctly injected in global routes
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/private/AppFramework/Routing/RouteConfig.php16
1 files changed, 15 insertions, 1 deletions
diff --git a/lib/private/AppFramework/Routing/RouteConfig.php b/lib/private/AppFramework/Routing/RouteConfig.php
index 0477f4dc209..c9464f506ae 100644
--- a/lib/private/AppFramework/Routing/RouteConfig.php
+++ b/lib/private/AppFramework/Routing/RouteConfig.php
@@ -30,6 +30,7 @@ declare(strict_types=1);
namespace OC\AppFramework\Routing;
use OC\AppFramework\DependencyInjection\DIContainer;
+use OCP\AppFramework\App;
use OCP\Route\IRouter;
/**
@@ -155,8 +156,21 @@ class RouteConfig {
$controllerName = $this->buildControllerName($controller);
$actionName = $this->buildActionName($action);
+ $appName = $simpleRoute['app'] ?? $this->appName;
+
+ if (isset($simpleRoute['app'])) {
+ // Legacy routes that need to be globally available while they are handled by an app
+ // E.g. '/f/{id}', '/s/{token}', '/call/{token}', …
+ $controllerName = str_replace('controllerController', 'Controller', $controllerName);
+ if ($controllerName === 'PublicpreviewController') {
+ $controllerName = 'PublicPreviewController';
+ } else if ($controllerName === 'RequesthandlerController') {
+ $controllerName = 'RequestHandlerController';
+ }
+ $controllerName = App::buildAppNamespace($appName) . '\\Controller\\' . $controllerName;
+ }
- $routeName = $this->appName . '.' . $controller . '.' . $action . $postfix;
+ $routeName = $appName . '.' . $controller . '.' . $action . $postfix;
// register the route
$handler = new RouteActionHandler($this->container, $controllerName, $actionName);