fix: path == '/'
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Baoshuo Ren 2022-09-20 15:44:04 +08:00
parent 29371d550e
commit bd09e2aae6
Signed by: baoshuo
GPG Key ID: 00CB9680AB29F51A
2 changed files with 4 additions and 2 deletions

View File

@ -97,8 +97,10 @@ class HTML {
// } // }
if ($param) { if ($param) {
$url .= $path.'?'.HTML::query_string_encode($param); $url .= $path.'?'.HTML::query_string_encode($param);
} else if ($url != '/') { } else if ($path != '/') {
$url .= rtrim($path, '/'); $url .= rtrim($path, '/');
} else {
$url = $path;
} }
return HTML::escape($url); return HTML::escape($url);
} }

View File

@ -1,5 +1,5 @@
<div class="navbar navbar-light navbar-expand-md bg-light mb-4" role="navigation"> <div class="navbar navbar-light navbar-expand-md bg-light mb-4" role="navigation">
<a class="navbar-brand" href="/"><?= UOJConfig::$data['profile']['oj-name-short'] ?></a> <a class="navbar-brand" href="<?= HTML::url('/') ?>"><?= UOJConfig::$data['profile']['oj-name-short'] ?></a>
<button type="button" class="navbar-toggler collapsed" data-toggle="collapse" data-target=".navbar-collapse"> <button type="button" class="navbar-toggler collapsed" data-toggle="collapse" data-target=".navbar-collapse">
<span class="navbar-toggler-icon"></span> <span class="navbar-toggler-icon"></span>
</button> </button>