Skip to content

A free, self-hostable news aggregator…

dirname problem

Alexandre Alapetite2d22bf300a8d
diff --git a/lib/Minz/Request.php b/lib/Minz/Request.php
index b9eda82a5..67fbae126 100644
--- a/lib/Minz/Request.php
+++ b/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;
}