fix: 避免下载文件名过长及同名资源冲突 - #80
Merged
Merged
Conversation
wuziqian211
approved these changes
Aug 16, 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.
存在的问题
专题资源重复拼接标题
程序此前解析专题课程时,会直接按照以下格式组合专题父标题和内部资源标题:
但平台部分专题的父记录与内部 PDF 使用了完全相同的标题。例如 #76 中的:
原逻辑会生成:
下载时还会追加
.tmp,进一步增加文件名长度,可能超过文件系统限制并导致下载失败。不同版别的同名教材写入相同路径
程序此前仅使用资源标题生成保存路径,没有将教材版别纳入文件名。例如同时下载:
两项任务都会使用:
批量下载又是并行执行的,因此不同线程可能同时操作同一个
.tmp文件,造成文件覆盖、内容损坏、临时文件被其他线程提前改名,或者最终仅保留其中一个版别。修改内容
父标题 - 子标题(2)、(3)顺延.tmp已存在时,同样顺延编号最终文件名.pdf.tmp临时文件格式