[PR #669] [MERGED] fix(#664): 修复目录或文件名包含特殊字符‘&’时,笔记同步功能失效问题 #765

Closed
opened 2026-03-02 03:41:38 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/codexu/note-gen/pull/669
Author: @steven-jianhao-li
Created: 9/23/2025
Status: Merged
Merged: 9/26/2025
Merged by: @codexu

Base: devHead: dev


📝 Commits (1)

  • db74ff7 fix(#664): 修复目录或文件名包含特殊字符‘&’时,笔记同步功能失效问题

📊 Changes

1 file changed (+4 additions, -4 deletions)

View changed files

📝 src/lib/github.ts (+4 -4)

📄 Description

issue: #664
之前文件名和路径只是通过将空格替换为下划线来过滤。这不足以处理其他特殊字符(例如&),这会导致GitHub API请求url出错。

这是个简单提交,在uploadFilegetFilesdeleteFilegetFileCommits函数中使用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 encodeURIComponent in the uploadFile, getFiles, deleteFile, and getFileCommits functions. This ensures all special characters are properly encoded, preventing API failures when handling files with non-standard names.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/codexu/note-gen/pull/669 **Author:** [@steven-jianhao-li](https://github.com/steven-jianhao-li) **Created:** 9/23/2025 **Status:** ✅ Merged **Merged:** 9/26/2025 **Merged by:** [@codexu](https://github.com/codexu) **Base:** `dev` ← **Head:** `dev` --- ### 📝 Commits (1) - [`db74ff7`](https://github.com/codexu/note-gen/commit/db74ff76e214f19e2de6768b13795344e6af02fa) fix(#664): 修复目录或文件名包含特殊字符‘&’时,笔记同步功能失效问题 ### 📊 Changes **1 file changed** (+4 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `src/lib/github.ts` (+4 -4) </details> ### 📄 Description issue: [#664](https://github.com/codexu/note-gen/issues/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 `encodeURIComponent` in the `uploadFile`, `getFiles`, `deleteFile`, and `getFileCommits` functions. This ensures all special characters are properly encoded, preventing API failures when handling files with non-standard names. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-02 03:41:38 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/note-gen#765
No description provided.