Fixed sort urls with no params not building full path

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
This commit is contained in:
Dan Brown 2023-04-27 13:47:49 +01:00
parent 607da73109
commit 647ce6c237
No known key found for this signature in database
GPG Key ID: 46D9F943C24A2EF9

View File

@ -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.
*/
@ -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));