fix(#664): 修复目录或文件名包含特殊字符‘&’时,笔记同步功能失效问题#669
Merged
codexu merged 1 commit intocodexu:devfrom Sep 26, 2025
Merged
Conversation
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.
issue: #664
之前文件名和路径只是通过将空格替换为下划线来过滤。这不足以处理其他特殊字符(例如
&),这会导致GitHub API请求url出错。这是个简单提交,在
uploadFile、getFiles、deleteFile和getFileCommits函数中使用encodeURIComponent封装了文件名和路径。这确保所有特殊字符都被正确编码,防止API在处理具有非标准名称的文件时失败。Previously, filenames and paths were only sanitized by replacing spaces with underscores. This was insufficient for handling other special characters (e.g.,
&), which could lead to broken GitHub API request URLs.This commit wraps filenames and paths with
encodeURIComponentin theuploadFile,getFiles,deleteFile, andgetFileCommitsfunctions. This ensures all special characters are properly encoded, preventing API failures when handling files with non-standard names.