Skip to content

fix(mirror-redirect): 保留路径末尾斜杠,避免 cn-suffix 映射产出 /xxx/-cn - #3

Merged
cc-hearts merged 1 commit into
mainfrom
feat/mirror-redirect
Sep 12, 2026
Merged

cc-hearts merged 1 commit into
mainfrom
feat/mirror-redirect

Conversation

@cc-hearts

Copy link
Copy Markdown
Member

🤔 本次变更属于 ...

  • 🆕 新功能
  • 🐞 Bug 修复
  • 📝 站点 / 文档改进
  • 📽️ Demo 改进
  • 💄 组件样式改进
  • 🤖 TypeScript 类型定义改进
  • 📦 包体积优化
  • ⚡️ 性能优化
  • ⭐️ 功能增强
  • 🌐 国际化
  • 🛠 重构
  • 🎨 代码风格优化
  • ✅ 测试用例
  • 🔀 分支合并
  • ⏩ 工作流
  • ⌨️ 无障碍改进
  • ❓ 其他(请说明)

🔗 相关 Issue

#2(同一分支,新提交在其合并后推送,故单独开 PR)。

💡 背景与方案

PR #2 合并后,feat/mirror-redirect 又推送了一笔提交。cn-suffix 路径映射此前直接拼接后缀:

/components/button/  ->  /components/button/-cn

后缀落在路径分段之后而不是分段内,镜像站上就是 404。现在改为先剥离末尾斜杠、在分段上判定与追加,再把斜杠还原:

/components/button/     ->  /components/button-cn/
/~demos/button/         ->  /~demos/button/      (不变)
/components/button-cn/  ->  /components/button-cn/(幂等,不变)

/'' 仍映射到 /index-cn,无末尾斜杠的路径行为不变。

📝 变更日志

语言 变更日志
🇺🇸 英文 Fix cn-suffix pathname 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

@cc-hearts
cc-hearts merged commit dccdac9 into main Sep 12, 2026
@cc-hearts
cc-hearts deleted the feat/mirror-redirect branch September 12, 2026 11:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant