浏览代码

dirname problem

https://github.com/FreshRSS/FreshRSS/issues/906
Alexandre Alapetite 10 年之前
父节点
当前提交
2d22bf300a
共有 1 个文件被更改,包括 4 次插入1 次删除
  1. 4 1
      lib/Minz/Request.php

+ 4 - 1
lib/Minz/Request.php

@@ -100,7 +100,10 @@ class Minz_Request {
 			} else {
 				$url .= '://' . $host . ($port == 80 ? '' : ':' . $port);
 			}
-			$url .= isset($_SERVER['REQUEST_URI']) ? dirname($_SERVER['REQUEST_URI']) : '';
+			if (isset($_SERVER['REQUEST_URI'])) {
+				$path = $_SERVER['REQUEST_URI'];
+				$url .= substr($path, -1) === '/' ? substr($path, 0, -1) : dirname($path);
+			}
 		} else {
 			$url = rtrim($url, '/\\') . $baseUrlSuffix;
 		}