Skip to content

Commit

Permalink
remove basename() from App::url() page build
Browse files Browse the repository at this point in the history
  • Loading branch information
mvorisek committed Sep 17, 2023
1 parent 637f66a commit 8d7cab6
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/App.php
Original file line number Diff line number Diff line change
Expand Up @@ -673,13 +673,11 @@ public function url($page = [], array $extraRequestUrlArgs = []): string
if ($pagePath === '') { // TODO path must always start with '/'
$pagePath = '/';
}
if (substr($pagePath, -1) === '/') {
$pagePath = $this->urlBuildingIndexPage;
} else {
$pagePath = basename($pagePath, $this->urlBuildingExt);
}
}
if (!str_contains(basename($pagePath), '.')) {
if (str_ends_with($pagePath, '/')) {
$pagePath .= $this->urlBuildingIndexPage;
}
if (!str_ends_with($pagePath, '/') && !str_contains(basename($pagePath), '.')) {
$pagePath .= $this->urlBuildingExt;
}

Expand Down

0 comments on commit 8d7cab6

Please sign in to comment.