utils.test.ts
25.8 KB
-
当 DOCX 文件名包含空格时(如 新建 DOCX 文档 (2).docx),会触发以下连锁反应导致图片 404 (#7432) · 7b382e80
* Fix regex for S3 markdown and improve VLM model fallback Update regex pattern for S3 markdown key and adjust fallback logic for VLM model retrieval. [^)]+? → [^)>]+?:在排除列表中增加 > 字符 (${pattern}) → <?(${pattern})>?:URL 前后添加可选的 <> 包裹匹配 * Implement space replacement in S3 key handling Add function to replace spaces with underscores in S3 key. 在 replaceParentheses 后新增 replaceSpaces,将所有空白字符(\s+)替换为下划线,避免新上传的文件产生含空格的 S3 key。 * Fix filename formatting tests in utils.test.ts Updated test cases to ensure formatted filenames replace spaces with underscores and handle multiple spaces correctly. 更新 getFormatedFilename 的空格文件名测试期望 更新真实场景的测试期望 新增 5 个空格替换测试用例(单独替换、括号+空格组合、连续空格、首尾空格等场景) * fix: handle S3 markdown key edge cases --------- Co-authored-by: Xianquan <whoeverimf5@gmail.com>ai123 committed