fix: 修复子目录部署时支付回调地址(return_url)丢失路径的问题 #768
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
问题描述:
当 Xboard 部署在子目录(例如
https://domain.com/main/)时,支付功能生成的return_url会发生错误。原因是
app/Helpers/Functions.php中的source_base_url辅助函数在解析 Referer 时,只提取了scheme和host,忽略了 URL 中的路径部分 (path)。这导致支付插件生成的跳转地址丢失了
/main/目录(变成了https://domain.com/#/order/...),导致用户支付完成后无法正确跳转回订单页面。修复内容:
修改了
source_base_url函数的逻辑:在解析 Referer 时,如果检测到 URL 中包含路径(path),则将其保留并拼接到 baseUrl 后面,从而正确支持子目录部署。