File tree Expand file tree Collapse file tree 1 file changed +21
-8
lines changed Expand file tree Collapse file tree 1 file changed +21
-8
lines changed Original file line number Diff line number Diff line change @@ -581,11 +581,30 @@ public function __toString(): string
581581 $ path = $ this ->getPath ();
582582 $ scheme = $ this ->getScheme ();
583583
584+ // If the hosts matches then assume this should be relative to baseURL
585+ [$ scheme , $ path ] = $ this ->changeSchemeAndPath ($ scheme , $ path );
586+
587+ return static ::createURIString (
588+ $ scheme ,
589+ $ this ->getAuthority (),
590+ $ path , // Absolute URIs should use a "/" for an empty path
591+ $ this ->getQuery (),
592+ $ this ->getFragment ()
593+ );
594+ }
595+
596+ /**
597+ * Change the path (and scheme) assuming URIs with the same host as baseURL
598+ * should be relative to the project's configuration.
599+ *
600+ * @deprecated This method will be deleted.
601+ */
602+ private function changeSchemeAndPath (string $ scheme , string $ path ): array
603+ {
584604 // Check if this is an internal URI
585605 $ config = config ('App ' );
586606 $ baseUri = new self ($ config ->baseURL );
587607
588- // If the hosts matches then assume this should be relative to baseURL
589608 if (
590609 substr ($ this ->getScheme (), 0 , 4 ) === 'http '
591610 && $ this ->getHost () === $ baseUri ->getHost ()
@@ -604,13 +623,7 @@ public function __toString(): string
604623 }
605624 }
606625
607- return static ::createURIString (
608- $ scheme ,
609- $ this ->getAuthority (),
610- $ path , // Absolute URIs should use a "/" for an empty path
611- $ this ->getQuery (),
612- $ this ->getFragment ()
613- );
626+ return [$ scheme , $ path ];
614627 }
615628
616629 /**
You can’t perform that action at this time.
0 commit comments