ansible-roles/library/centos/roles/owncloud/files/Request.php.diff

55 lines
2.0 KiB
Diff

--- Request.php.orig 2016-09-29 16:07:47.995919050 +0200
+++ Request.php 2016-09-29 16:08:11.840177683 +0200
@@ -593,8 +593,19 @@
*/
public function getRequestUri() {
$uri = isset($this->server['REQUEST_URI']) ? $this->server['REQUEST_URI'] : '';
+
+
+ $script_name = $_SERVER['SCRIPT_NAME'];
+ if (array_key_exists('PATH_INFO', $_SERVER) === true) {
+ $pos = strpos($_SERVER['SCRIPT_NAME'], rawurldecode($_SERVER['PATH_INFO']));
+ if ($pos === false) {
+ } else {
+ $script_name = substr($_SERVER['SCRIPT_NAME'], 0, $pos);
+ }
+ }
+
if($this->config->getSystemValue('overwritewebroot') !== '' && $this->isOverwriteCondition()) {
- $uri = $this->getScriptName() . substr($uri, strlen($this->server['SCRIPT_NAME']));
+ $uri = $this->getScriptName() . substr($uri, strlen($script_name));
}
return $uri;
}
@@ -619,6 +630,14 @@
}
$scriptName = $this->server['SCRIPT_NAME'];
+ if (array_key_exists('PATH_INFO', $_SERVER) === true) {
+ $pos = strpos($_SERVER['SCRIPT_NAME'], rawurldecode($_SERVER['PATH_INFO']));
+ if ($pos === false) {
+ } else {
+ $scriptName = substr($_SERVER['SCRIPT_NAME'], 0, $pos);
+ }
+ }
+
$pathInfo = $requestUri;
// strip off the script name's dir and file name
@@ -676,6 +695,15 @@
*/
public function getScriptName() {
$name = $this->server['SCRIPT_NAME'];
+
+ if (array_key_exists('PATH_INFO', $_SERVER) === true) {
+ $pos = strpos($_SERVER['SCRIPT_NAME'], rawurldecode($_SERVER['PATH_INFO']));
+ if ($pos === false) {
+ } else {
+ $name = substr($_SERVER['SCRIPT_NAME'], 0, $pos);
+ }
+ }
+
$overwriteWebRoot = $this->config->getSystemValue('overwritewebroot');
if ($overwriteWebRoot !== '' && $this->isOverwriteCondition()) {
// FIXME: This code is untestable due to __DIR__, also that hardcoded path is really dangerous