From 31f9be7a75712e9f8b7831ed29397527f9fa8baf Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Wed, 29 Mar 2017 11:03:53 +0200 Subject: [PATCH] Match slashes in ../{id} resource routes Fixes #2954 Before we could match on /{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 --- lib/private/AppFramework/Routing/RouteConfig.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/private/AppFramework/Routing/RouteConfig.php b/lib/private/AppFramework/Routing/RouteConfig.php index 70208725f4..e2675a3c84 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' => '[^?]*' + ]); + } } } }