fix(mirror-redirect): 保留路径末尾斜杠,避免 cn-suffix 映射产出 /xxx/-cn - #3
Merged
Merged
Conversation
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.
🤔 本次变更属于 ...
🔗 相关 Issue
#2(同一分支,新提交在其合并后推送,故单独开 PR)。
💡 背景与方案
PR #2 合并后,
feat/mirror-redirect又推送了一笔提交。cn-suffix路径映射此前直接拼接后缀:后缀落在路径分段之后而不是分段内,镜像站上就是 404。现在改为先剥离末尾斜杠、在分段上判定与追加,再把斜杠还原:
/与''仍映射到/index-cn,无末尾斜杠的路径行为不变。📝 变更日志
cn-suffixpathname mapping so a trailing slash stays at the end:/button/now maps to/button-cn/instead of the broken/button/-cn.cn-suffix路径映射:末尾斜杠不再被-cn挤到中间,/button/正确映射为/button-cn/,而非此前会 404 的/button/-cn。