File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ protected function __clone() {
2626
2727 /**
2828 * Get core container
29+ * Singleton pattern
2930 *
3031 * @return Pimple\Container
3132 */
@@ -55,6 +56,13 @@ public static function getRelativeURIToRoot($path = '') {
5556 $ postUrl = static ::$ request ->getUri ()->getPath ();
5657 $ basePath = static ::$ request ->getUri ()->getBasePath ();
5758
59+ $ prefix = '' ;
60+ // If no slash at root (should not happen normally), prefix with the current base path
61+ if ($ postUrl === '/ ' && substr (static ::$ request ->getServerParam ('PATH_INFO ' ), -1 ) !== '/ ' ) {
62+ $ token = explode ('/ ' , static ::$ request ->getServerParam ('PATH_INFO ' ));
63+ $ prefix = $ token [count ($ token ) - 1 ] . '/ ' ;
64+ }
65+
5866 // Be sure to have a clean path
5967 $ postUrl = str_replace (['// ' , '/// ' ], '/ ' , $ postUrl );
6068
@@ -65,7 +73,7 @@ public static function getRelativeURIToRoot($path = '') {
6573 ++$ slashNb ;
6674 }
6775
68- return str_repeat ('../ ' , max ($ slashNb , 0 )) . $ path ;
76+ return $ prefix . str_repeat ('../ ' , max ($ slashNb , 0 )) . $ path ;
6977 }
7078
7179 /**
You can’t perform that action at this time.
0 commit comments