Skip to content

Commit 0674874

Browse files
committed
refactor: remove adjustPathTrailingSlash()
1 parent 76dfd39 commit 0674874

1 file changed

Lines changed: 2 additions & 20 deletions

File tree

system/HTTP/SiteURI.php

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ public function baseUrl($relativePath = '', ?string $scheme = null): string
384384
return URI::createURIString(
385385
$uri->getScheme(),
386386
$uri->getAuthority(),
387-
$this->adjustPathTrailingSlash($uri, $relativePath),
387+
$uri->getPath(),
388388
$uri->getQuery(),
389389
$uri->getFragment()
390390
);
@@ -420,30 +420,12 @@ public function siteUrl($relativePath = '', ?string $scheme = null, ?App $config
420420

421421
$uri = new self($config, $relativePath, $host, $scheme);
422422

423-
// Adjust path
424-
$path = $this->adjustPathTrailingSlash($uri, $relativePath);
425-
if ($config->indexPage !== '' && $relativePath === '') {
426-
$path = rtrim($path, '/');
427-
}
428-
429423
return URI::createURIString(
430424
$uri->getScheme(),
431425
$uri->getAuthority(),
432-
$path,
426+
$uri->getPath(),
433427
$uri->getQuery(),
434428
$uri->getFragment()
435429
);
436430
}
437-
438-
private function adjustPathTrailingSlash(self $uri, string $relativePath): string
439-
{
440-
$parts = parse_url($this->getBaseURL() . $relativePath);
441-
$path = $parts['path'] ?? '';
442-
443-
if (substr($path, -1) === '/' && substr($uri->getPath(), -1) !== '/') {
444-
return $uri->getPath() . '/';
445-
}
446-
447-
return $uri->getPath();
448-
}
449431
}

0 commit comments

Comments
 (0)