diff options
-rw-r--r-- | lib/private/AppFramework/Routing/RouteConfig.php | 8 | ||||
-rw-r--r-- | lib/private/AppFramework/Routing/RouteParser.php | 8 | ||||
-rw-r--r-- | lib/private/Route/Router.php | 37 |
3 files changed, 36 insertions, 17 deletions
diff --git a/lib/private/AppFramework/Routing/RouteConfig.php b/lib/private/AppFramework/Routing/RouteConfig.php index 6e3e49e8d99..7d63e5477ce 100644 --- a/lib/private/AppFramework/Routing/RouteConfig.php +++ b/lib/private/AppFramework/Routing/RouteConfig.php @@ -136,7 +136,13 @@ class RouteConfig { $controllerName = $this->buildControllerName($controller); $actionName = $this->buildActionName($action); - $routeName = $routeNamePrefix . $this->appName . '.' . $controller . '.' . $action . $postfix; + /* + * The route name has to be lowercase, for symfony to match it correctly. + * This is required because smyfony allows mixed casing for controller names in the routes. + * To avoid breaking all the existing route names, registering and matching will only use the lowercase names. + * This is also safe on the PHP side because class and method names collide regardless of the casing. + */ + $routeName = strtolower($routeNamePrefix . $this->appName . '.' . $controller . '.' . $action . $postfix); $router = $this->router->create($routeName, $url) ->method($verb); diff --git a/lib/private/AppFramework/Routing/RouteParser.php b/lib/private/AppFramework/Routing/RouteParser.php index 1b3a6c1255a..1b05c23df9d 100644 --- a/lib/private/AppFramework/Routing/RouteParser.php +++ b/lib/private/AppFramework/Routing/RouteParser.php @@ -100,7 +100,13 @@ class RouteParser { $controllerName = $this->buildControllerName($controller); $actionName = $this->buildActionName($action); - $routeName = $routeNamePrefix . $appName . '.' . $controller . '.' . $action . $postfix; + /* + * The route name has to be lowercase, for symfony to match it correctly. + * This is required because smyfony allows mixed casing for controller names in the routes. + * To avoid breaking all the existing route names, registering and matching will only use the lowercase names. + * This is also safe on the PHP side because class and method names collide regardless of the casing. + */ + $routeName = strtolower($routeNamePrefix . $appName . '.' . $controller . '.' . $action . $postfix); $routeObject = new Route($url); $routeObject->method($verb); diff --git a/lib/private/Route/Router.php b/lib/private/Route/Router.php index 65bbf602be0..9cf12f00185 100644 --- a/lib/private/Route/Router.php +++ b/lib/private/Route/Router.php @@ -360,6 +360,13 @@ class Router implements IRouter { if ($absolute === false) { $referenceType = UrlGenerator::ABSOLUTE_PATH; } + /* + * The route name has to be lowercase, for symfony to match it correctly. + * This is required because smyfony allows mixed casing for controller names in the routes. + * To avoid breaking all the existing route names, registering and matching will only use the lowercase names. + * This is also safe on the PHP side because class and method names collide regardless of the casing. + */ + $name = strtolower($name); $name = $this->fixLegacyRootName($name); if (str_contains($name, '.')) { [$appName, $other] = explode('.', $name, 3); @@ -385,29 +392,29 @@ class Router implements IRouter { } protected function fixLegacyRootName(string $routeName): string { - if ($routeName === 'files.viewcontroller.showFile') { - return 'files.View.showFile'; + if ($routeName === 'files.viewcontroller.showfile') { + return 'files.view.showfile'; } - if ($routeName === 'files_sharing.sharecontroller.showShare') { - return 'files_sharing.Share.showShare'; + if ($routeName === 'files_sharing.sharecontroller.showshare') { + return 'files_sharing.share.showshare'; } - if ($routeName === 'files_sharing.sharecontroller.showAuthenticate') { - return 'files_sharing.Share.showAuthenticate'; + if ($routeName === 'files_sharing.sharecontroller.showauthenticate') { + return 'files_sharing.share.showauthenticate'; } if ($routeName === 'files_sharing.sharecontroller.authenticate') { - return 'files_sharing.Share.authenticate'; + return 'files_sharing.share.authenticate'; } - if ($routeName === 'files_sharing.sharecontroller.downloadShare') { - return 'files_sharing.Share.downloadShare'; + if ($routeName === 'files_sharing.sharecontroller.downloadshare') { + return 'files_sharing.share.downloadshare'; } - if ($routeName === 'files_sharing.publicpreview.directLink') { - return 'files_sharing.PublicPreview.directLink'; + if ($routeName === 'files_sharing.publicpreview.directlink') { + return 'files_sharing.publicpreview.directlink'; } - if ($routeName === 'cloud_federation_api.requesthandlercontroller.addShare') { - return 'cloud_federation_api.RequestHandler.addShare'; + if ($routeName === 'cloud_federation_api.requesthandlercontroller.addshare') { + return 'cloud_federation_api.requesthandler.addshare'; } - if ($routeName === 'cloud_federation_api.requesthandlercontroller.receiveNotification') { - return 'cloud_federation_api.RequestHandler.receiveNotification'; + if ($routeName === 'cloud_federation_api.requesthandlercontroller.receivenotification') { + return 'cloud_federation_api.requesthandler.receivenotification'; } return $routeName; } |