We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 17d75e3 commit 8b73e30Copy full SHA for 8b73e30
app/Utils/UrlUtils.php
@@ -23,8 +23,15 @@ static function getSubPath(string $url) : string {
23
if(!$doesMatch || !isset($matches[1])) {
24
return '/';
25
}
26
-
27
- $subpathUrl = trim($matches[1]);
28
- return Str::start(trim($subpathUrl, '/'), '/');
+ $trimDefaultCharacters = " \n\r\t\v\0";
+ // Remove all irrelevant characters from the subpath
+ // including all leading and trailing slashes.
29
+ $subPathUrl = trim($matches[1], $trimDefaultCharacters . '/');
30
+ if(empty($subPathUrl)) {
31
+ return '/';
32
+ }
33
+
34
+ // Add leading slash to the subpath.
35
+ return '/' . $subPathUrl;
36
37
0 commit comments