Merge pull request #13552 from owncloud/request-uri-double-slash

Remove duplicated slashes from the requested url
remotes/origin/create-share-target-reuse
Thomas Müller 2015-01-21 21:56:09 +07:00
commit c13bf8d820
2 changed files with 3 additions and 0 deletions

@ -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);

@ -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'),
);
}