File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -92,24 +92,23 @@ public function __construct(
9292 ?string $ host = null ,
9393 ?string $ scheme = null
9494 ) {
95- $ baseURL = $ this ->normalizeBaseURL ($ configApp );
9695 $ this ->indexPage = $ configApp ->indexPage ;
9796
97+ $ baseURL = $ this ->normalizeBaseURL ($ configApp );
9898 $ this ->setBasePath ($ baseURL );
9999
100+ $ relativePath = URI ::removeDotSegments ($ relativePath );
101+ // Remove starting slash
102+ if ($ relativePath !== '' && $ relativePath [0 ] === '/ ' ) {
103+ $ relativePath = ltrim ($ relativePath , '/ ' );
104+ }
105+
100106 // Check for an index page
101107 $ indexPage = '' ;
102108 if ($ configApp ->indexPage !== '' ) {
103- $ indexPage = $ configApp ->indexPage ;
104-
105- // Check if we need a separator
106- if ($ relativePath !== '' && $ relativePath [0 ] !== '/ ' && $ relativePath [0 ] !== '? ' ) {
107- $ indexPage .= '/ ' ;
108- }
109+ $ indexPage = $ configApp ->indexPage . '/ ' ;
109110 }
110111
111- $ relativePath = URI ::removeDotSegments ($ relativePath );
112-
113112 $ tempUri = $ baseURL . $ indexPage . $ relativePath ;
114113 $ uri = new URI ($ tempUri );
115114
@@ -254,7 +253,7 @@ public function __toString(): string
254253 return static ::createURIString (
255254 $ this ->getScheme (),
256255 $ this ->getAuthority (),
257- $ this ->getPath (), // Absolute URIs should use a "/" for an empty path
256+ $ this ->getPath (),
258257 $ this ->getQuery (),
259258 $ this ->getFragment ()
260259 );
You can’t perform that action at this time.
0 commit comments