Skip to content

插入资源文件时文件名长度最大限制 189 字节 #7099

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
88250 opened this issue Jan 17, 2023 · 6 comments
Closed

插入资源文件时文件名长度最大限制 189 字节 #7099

88250 opened this issue Jan 17, 2023 · 6 comments
Assignees
Milestone

Comments

@88250
Copy link
Member

88250 commented Jan 17, 2023

过长的资源文件名会导致同步后某些系统平台上迁出失败 #7097

大部分系统对于文件名最大长度支持都是 255 字节,但是由于编码方式不同,我们只能取较大编码算法进行计算(3 或 4 个字节),也就是 255-11(临时文件后缀)-23(id 部分)- 5 左右后缀 = 216 字节,216/3 = 72 字 或 216/4 = 54 字,由于大部分字都是 3 字节,所以取一个中间值大约是 63 字,63*3 = 189 字节

插入资源文件时,文件名长度大于 189 字节则自动删除过长的部分。已有文件不做处理。

@88250 88250 added this to the 2.7.1 milestone Jan 17, 2023
@88250 88250 self-assigned this Jan 17, 2023
@88250 88250 changed the title 检查插入资源文件时文件名长度最大限制 192 字节 插入资源文件时文件名长度最大限制 192 字节 Jan 17, 2023
@88250 88250 changed the title 插入资源文件时文件名长度最大限制 192 字节 插入资源文件时文件名长度最大限制 189 字节 Jan 17, 2023
@88250 88250 closed this as completed Jan 17, 2023
@88250 88250 changed the title 插入资源文件时文件名长度最大限制 189 字节 插入资源文件时文件名长度最大限制 63 字 Jan 18, 2023
@88250 88250 changed the title 插入资源文件时文件名长度最大限制 63 字 插入资源文件时文件名长度最大限制 63 个字 Jan 18, 2023
@Zuoqiu-Yingyi
Copy link
Contributor

这是是不是应该对 ASCII 字符与非 ASCII 字符分别计算呢

@88250
Copy link
Member Author

88250 commented Jan 20, 2023

是的,现在的实现有点粗暴。

@Zuoqiu-Yingyi
Copy link
Contributor

那我今天找时间研究一下在合法字符之间根据字节长度进行切片的解决方案

@88250
Copy link
Member Author

88250 commented Jan 20, 2023

不用了,我在改了,等会提交你 review 下。

@88250 88250 changed the title 插入资源文件时文件名长度最大限制 63 个字 插入资源文件时文件名长度最大限制 189 字节 Jan 20, 2023
@88250
Copy link
Member Author

88250 commented Jan 20, 2023

@Zuoqiu-Yingyi 已经提交

@Zuoqiu-Yingyi
Copy link
Contributor

@88250 用了几个测试用例, 应该没啥问题 o( ̄▽ ̄)d

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants