Repository navigation
fix(frontend): prefix raw-anchor and native navigations under subpath deployments - #4559
Merged
Merged
Conversation
… deployments antd Button href and plain <a> tags render raw anchors that bypass the Next.js router, so app-internal paths need withBasePath explicitly: - agent publication preview button now navigates via location.assign (shareUrl already carries the prefix; antd href would double it) - API Key links (publication page + usage guide modal) get withBasePath - oauth complete back-home button gets withBasePath - account deletion redirect gets withBasePath
jeffwu-1999
requested review from
WMC001,
YehongPan,
hhhhsc701 and
xuyaqist
as code owners
December 4, 2026 07:20
xuyaqist
approved these changes
Dec 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
问题
#4558 镜像问题:裸锚点/原生跳转漏加前缀。antd Button href、裸
<a>、window.location不经过 Next router,框架不会自动加 basePath,必须手动withBasePath。现网表现:智能体发布页点"API Key: 点击获取"跳到根路径
/zh/users→ 404/被踢回首页。修复(4 处,全前端扫描确认无遗漏)
window.location.assign(shareUrl)(shareUrl 已带前缀,语义明确)<a>补withBasePathwithBasePathwindow.location.href补withBasePath验证
/nexent子路径镜像实测:API Key 链接正常跳/nexent/zh/users后续
需要做统一导航封装(重一点),防止霰弹式修改:收敛一个 navigate()/ 出口,内部按目标类型(router/原生/外部)自动决定加不加前缀,业务代码不再直接接触 withBasePath。改动面大,适合后续重构做。