]> source.dussan.org Git - nextcloud-server.git/commitdiff
Match slashes in ../{id} resource routes 4138/head
authorRoeland Jago Douma <roeland@famdouma.nl>
Wed, 29 Mar 2017 09:03:53 +0000 (11:03 +0200)
committerRoeland Jago Douma <roeland@famdouma.nl>
Tue, 4 Apr 2017 06:37:11 +0000 (08:37 +0200)
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>
lib/private/AppFramework/Routing/RouteConfig.php

index 70208725f4636cb32b9f1bb3c1c5457ec6d3fe7a..e2675a3c847365d8dfc1a1417cb39b0e0b52f386 100644 (file)
@@ -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' => '[^?]*'
+                                       ]);
+                               }
                        }
                }
        }