From 04075eba6b83a71a9af17bc2cfcbdcfe31a76af2 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Wed, 21 Jan 2015 15:04:18 +0100 Subject: Remove duplicated slashes from the requested url --- lib/private/request.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/private/request.php b/lib/private/request.php index 3c33dfc340a..3bf7d94d9cf 100644 --- a/lib/private/request.php +++ b/lib/private/request.php @@ -278,6 +278,8 @@ class OC_Request { $requestUri = '/' . ltrim($requestUri, '/'); } + $requestUri = preg_replace('%/{2,}%', '/', $requestUri); + // Remove the query string from REQUEST_URI if ($pos = strpos($requestUri, '?')) { $requestUri = substr($requestUri, 0, $pos); -- cgit v1.2.3 From 0b9f7642a61d440764f96f4abbc174f175610e09 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Wed, 21 Jan 2015 17:18:47 +0100 Subject: Add unit test --- tests/lib/request.php | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/lib/request.php b/tests/lib/request.php index ea3722b90a6..dd6d1e47cd5 100644 --- a/tests/lib/request.php +++ b/tests/lib/request.php @@ -84,6 +84,7 @@ class Test_Request extends \Test\TestCase { array('/core/ajax/translations.php', '/core/ajax/translations.php', 'index.php'), array('/core/ajax/translations.php', '//core/ajax/translations.php', '/index.php'), array('/core/ajax/translations.php', '/oc/core/ajax/translations.php', '/oc/index.php'), + array('/core/ajax/translations.php', '/oc//index.php/core/ajax/translations.php', '/oc/index.php'), array('/1', '/oc/core/1', '/oc/core/index.php'), ); } -- cgit v1.2.3