refactor: BackUrl::selfWithoutBack 统一 selfWithoutBack 构造并修复 currentQuery 依赖

This commit is contained in:
萝卜
2026-03-14 18:52:28 +00:00
parent b759a87a57
commit 956e177544
6 changed files with 24 additions and 26 deletions

View File

@@ -10,12 +10,10 @@
$SYNC_FAILED_REASON_TRUNCATE_LEN = (int) config('saasshop.platform_orders.sync_failed_reason_display_truncate_len', 60);
// back 参数用于“返回上一页(保留上下文)”,但 back 本身不应再包含 back避免无限嵌套导致 URL 膨胀)
$selfWithoutBack = \App\Support\BackUrl::selfWithoutBack();
$currentQuery = request()->query();
unset($currentQuery['back']);
$selfWithoutBack = '/' . ltrim(request()->path(), '/');
if (count($currentQuery) > 0) {
$selfWithoutBack .= '?' . \Illuminate\Support\Arr::query($currentQuery);
}
// back 安全护栏(全页通用):
// - 仅允许站内相对路径(/ 开头)