aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBernhard Posselt <nukeawhale@gmail.com>2013-02-27 13:43:47 -0800
committerBernhard Posselt <nukeawhale@gmail.com>2013-02-27 13:43:47 -0800
commit2f036bcc5425bc1b67f7caad4da78ab3efd0fba2 (patch)
tree73d71c87014d02af6e4fcbc619f4190575528f13
parent8a0d786d66e31d80742f2581ea3838112855e24c (diff)
parent56f3917f362432e1674ba8b319fe8f4726f84dc2 (diff)
downloadnextcloud-server-2f036bcc5425bc1b67f7caad4da78ab3efd0fba2.tar.gz
nextcloud-server-2f036bcc5425bc1b67f7caad4da78ab3efd0fba2.zip
Merge pull request #1972 from owncloud/raw-pathinfo
Use the plain urlencoded path info for the routing matching
-rw-r--r--lib/base.php2
-rwxr-xr-xlib/request.php15
2 files changed, 15 insertions, 2 deletions
diff --git a/lib/base.php b/lib/base.php
index 0e751c0f0ec..f70496912df 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -597,7 +597,7 @@ class OC {
if (!self::$CLI) {
try {
OC_App::loadApps();
- OC::getRouter()->match(OC_Request::getPathInfo());
+ OC::getRouter()->match(OC_Request::getRawPathInfo());
return;
} catch (Symfony\Component\Routing\Exception\ResourceNotFoundException $e) {
//header('HTTP/1.0 404 Not Found');
diff --git a/lib/request.php b/lib/request.php
index 30a25df23ab..9f74cf9beb5 100755
--- a/lib/request.php
+++ b/lib/request.php
@@ -107,7 +107,7 @@ class OC_Request {
if (array_key_exists('PATH_INFO', $_SERVER)) {
$path_info = $_SERVER['PATH_INFO'];
}else{
- $path_info = substr($_SERVER['REQUEST_URI'], strlen($_SERVER['SCRIPT_NAME']));
+ $path_info = self::getRawPathInfo();
// following is taken from Sabre_DAV_URLUtil::decodePathSegment
$path_info = rawurldecode($path_info);
$encoding = mb_detect_encoding($path_info, array('UTF-8', 'ISO-8859-1'));
@@ -124,6 +124,19 @@ class OC_Request {
}
/**
+ * @brief get Path info from request, not urldecoded
+ * @returns string Path info or false when not found
+ */
+ public static function getRawPathInfo() {
+ $path_info = substr($_SERVER['REQUEST_URI'], strlen($_SERVER['SCRIPT_NAME']));
+ // Remove the query string from REQUEST_URI
+ if ($pos = strpos($path_info, '?')) {
+ $path_info = substr($path_info, 0, $pos);
+ }
+ return $path_info;
+ }
+
+ /**
* @brief Check if this is a no-cache request
* @returns true for no-cache
*/