feat(alias): support filename escaping - #2868
Open
qbisi wants to merge 2 commits into
Open
Conversation
qbisi
marked this pull request as ready for review
July 29, 2026 21:39
- 增加默认关闭的文件名转义配置 - 在 Alias 读写边界转换 UTF-16 转义名称 - 保留后端真实路径并兼容未转义的已有文件 Co-authored-by: Codex <267193182+codex@users.noreply.github.com>
- add an opt-in setting to rename matching backend objects during directory listing - preserve original paths when automatic renaming fails Co-authored-by: Codex <267193182+codex@users.noreply.github.com>
qbisi
force-pushed
the
feat/alias-filename-escape
branch
from
July 30, 2026 01:14
af6b3c6 to
5798aff
Compare
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.
该 feat 的一个直接 benefit 是用于 189cloud 文件名中
'和 U+4E73 字符的可逆替换:前者会被 189cloud 替换为不一致的\',后者会导致文件无法下载;替换后字符分别变为_x0027_、_x4E73_。_xHHHH_是一种在 XML、数据库以及电子表格解析中用于表示非法或无效字符的转义编码格式,其中 HHHH 代表该字符的四位十六进制 Unicode / UCS-2 编码。该格式能够兼容大部分网盘,是一种成熟的替换方案。由于新增了
filename_escape、filename_escape_chars和filename_auto_rename三个配置项,前端需要同步增加翻译。Summary / 摘要
为 Alias 存储增加默认关闭的
filename_escape和filename_auto_rename开关,以及按行配置待转义字符串的filename_escape_chars。开启文件名转义后,在 Alias 读写边界匹配配置字符串,并仅将匹配字符串的首字符转换为
_xHHHH_UTF-16 代码单元格式;同时保护原本存在的_xHHHH_字面量。读取列表时保留后端真实路径,仅向用户展示还原后的名称;创建目录、重命名、上传和 URL 上传时向后端传递转义后的名称。
开启
filename_auto_rename后,Alias 在列出目录时自动将命中的后端既有文件或目录重命名为转义名称;迁移失败时保留原路径并继续列出目录。直接获取文件时兼容已存在的未转义文件名。
改动仅限 Alias 驱动,不修改公共驱动接口或
internal文件系统流程。This PR has breaking changes.
/ 此 PR 包含破坏性变更。
This PR changes public API, config, storage format, or migration behavior.
/ 此 PR 修改了公开 API、配置、存储格式或迁移行为。
This PR requires corresponding changes in related repositories.
/ 此 PR 需要关联仓库同步修改。
Related Issues / 关联 Issue
Relates to #2792
Testing / 测试
go test ./...go test ./drivers/alias ./internal/op ./internal/fsgit diff --checkChecklist / 检查清单
/ 我已阅读 CONTRIBUTING。
/ 我确认此贡献符合仓库许可证、贡献规范和行为准则。
gofmt,go fmt, orprettierwhere applicable./ 我已按适用情况格式化变更代码。
/ 此 PR 已是 ready-for-review 状态,尚未额外请求维护者或 code owner 审查。
AI Disclosure / AI 使用声明
/ 此 PR 包含 AI 辅助内容。
Tools used / 使用工具:
Usage scope / 使用范围:
Code generation / 代码生成
Refactoring / 重构
Tests / 测试
Review assistance / 审查辅助
I have reviewed and validated all AI-assisted content included in this PR.
/ 已审查并验证此 PR 中包含的 AI 辅助内容。
I have ensured that all AI-assisted commits include
Co-Authored-Byattribution./ AI 辅助提交已包含
Co-authored-by归属信息。I can reproduce all AI-assisted content included in this PR without any AI tools.
/ 我可以在没有任何 AI 工具的情况下重现此 PR 中包含的所有 AI 辅助内容。