summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2015-01-21 21:56:09 +0100
committerThomas Müller <thomas.mueller@tmit.eu>2015-01-21 21:56:09 +0100
commitc13bf8d82049debe7f06247ffb9ab45fc76cd6f5 (patch)
tree1b13a409c1ed82101ce4cfe94c35a8d38769062d
parentdc4ceda2f5d1c8007ffd9b5cacbd794f06b1957d (diff)
parent0b9f7642a61d440764f96f4abbc174f175610e09 (diff)
downloadnextcloud-server-c13bf8d82049debe7f06247ffb9ab45fc76cd6f5.tar.gz
nextcloud-server-c13bf8d82049debe7f06247ffb9ab45fc76cd6f5.zip
Merge pull request #13552 from owncloud/request-uri-double-slash
Remove duplicated slashes from the requested url
-rw-r--r--lib/private/request.php2
-rw-r--r--tests/lib/request.php1
2 files changed, 3 insertions, 0 deletions
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);
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'),
);
}