diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2017-03-29 11:03:53 +0200 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2017-04-04 08:37:11 +0200 |
commit | 31f9be7a75712e9f8b7831ed29397527f9fa8baf (patch) | |
tree | 5910a620acfe05717429b00708d6413a1a2f094c /lib | |
parent | ec5377306d8824ab7f7e9e0f534c8fb9c2b81a65 (diff) | |
download | nextcloud-server-31f9be7a75712e9f8b7831ed29397527f9fa8baf.tar.gz nextcloud-server-31f9be7a75712e9f8b7831ed29397527f9fa8baf.zip |
Match slashes in ../{id} resource routes
Fixes #2954
Before we could match on <prefix>/{id} however if the id contains a /
this would not match properly. But since we define the resource routes
internally we now make sure that we match all chars (up until the ?).
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/AppFramework/Routing/RouteConfig.php | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/private/AppFramework/Routing/RouteConfig.php b/lib/private/AppFramework/Routing/RouteConfig.php index 70208725f46..e2675a3c847 100644 --- a/lib/private/AppFramework/Routing/RouteConfig.php +++ b/lib/private/AppFramework/Routing/RouteConfig.php @@ -231,9 +231,15 @@ class RouteConfig { $routeName = $this->appName . '.' . strtolower($resource) . '.' . strtolower($method); - $this->router->create($routeName, $url)->method($verb)->action( + $route = $this->router->create($routeName, $url)->method($verb)->action( new RouteActionHandler($this->container, $controllerName, $actionName) ); + + if (!$collectionAction) { + $route->requirements([ + 'id' => '[^?]*' + ]); + } } } } |