add trailing slash to post-login redirect because not having it seems to make browsers strip custom ports

This commit is contained in:
Andrew Dolgov 2023-03-22 17:44:43 +03:00
parent 0f9488ace0
commit 98483922bb
No known key found for this signature in database
GPG Key ID: 1A56B4FA25D4AF2A
1 changed files with 4 additions and 3 deletions

View File

@ -416,10 +416,11 @@ class Handler_Public extends Handler {
$_SESSION["login_error_msg"] ??= __("Incorrect username or password");
}
$return = clean($_REQUEST['return']);
$return = preg_replace("#/*$#", "", clean(urldecode($_REQUEST['return'] ?? "")));
if ($_REQUEST['return'] && mb_strpos($return, Config::get_self_url()) === 0) {
header("Location: " . clean($_REQUEST['return']));
if ($return && mb_strpos($return, Config::get_self_url()) === 0) {
# redirecting to something like http://hostname:8888/tt-rss without trailing slash seems to be working incorrectly
header("Location: $return/");
} else {
header("Location: " . Config::get_self_url());
}