Skip to content

Commit

Permalink
Fixed sort urls with no params not building full path
Browse files Browse the repository at this point in the history
The provided partial path would be return which may not resolve to the
full URL when used on systems like those hosting BookStack on a
sub-path.
Fixes #4201
  • Loading branch information
ssddanbrown committed Apr 27, 2023
1 parent 607da73 commit 647ce6c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ function icon(string $name, array $attrs = []): string
}

/**
* Generate a url with multiple parameters for sorting purposes.
* Generate a URL with multiple parameters for sorting purposes.
* Works out the logic to set the correct sorting direction
* Discards empty parameters and allows overriding.
*/
Expand All @@ -172,7 +172,7 @@ function sortUrl(string $path, array $data, array $overrideData = []): string
}

if (count($queryStringSections) === 0) {
return $path;
return url($path);
}

return url($path . '?' . implode('&', $queryStringSections));
Expand Down

0 comments on commit 647ce6c

Please sign in to comment.