fix(backurl): avoid duplicating back query when already present

This commit is contained in:
萝卜
2026-03-14 21:17:02 +00:00
parent 24e4cb4b0b
commit 84e860e403
2 changed files with 32 additions and 0 deletions

View File

@@ -114,6 +114,11 @@ class BackUrl
return $base . '?' . $backQuery;
}
// 若 path 自身已包含 back=(调用方误用),则不再追加,避免重复 back 造成 URL 膨胀/绕过。
if (preg_match('/(?:^|&)back=/', $qs)) {
return $base . '?' . $qs;
}
if ($preferFirst) {
return $base . '?' . $backQuery . '&' . $qs;
}