Skip to content

Commit 6ab7d74

Browse files
fix(shared): bare non-ASCII relative paths become file links
Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 3ac2bc9 commit 6ab7d74

2 files changed

Lines changed: 2 additions & 3 deletions

File tree

‎packages/shared/src/markdownLinks.test.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ describe("parseMarkdownFileLink", () => {
4949
},
5050
);
5151

52-
// regression: #16096 non-ASCII relative paths become file chips
5352
it.each([
5453
[
5554
"<Summer 2026/pastexam/線性代數/2025_midterm_exam1_易志偉_1222.pdf>",

‎packages/shared/src/markdownLinks.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ const RELATIVE_PATH_PREFIX_PATTERN = /^(~\/|\.{1,2}\/)/;
1717
// The final segment is optional so an explicit folder link may end in `/`
1818
// (`patches/`, `docs/My Folder/`). A bare name with no slash still fails.
1919
const RELATIVE_FILE_PATH_PATTERN =
20-
/^(?:[A-Za-z0-9._-]+(?: +[A-Za-z0-9._-]+)*\/)+(?:[A-Za-z0-9._-]+(?: +[A-Za-z0-9._-]+)*(?::\d+){0,2})?$/;
20+
/^(?:[\p{L}\p{N}\p{M}._-]+(?: +[\p{L}\p{N}\p{M}._-]+)*\/)+(?:[\p{L}\p{N}\p{M}._-]+(?: +[\p{L}\p{N}\p{M}._-]+)*(?::\d+){0,2})?$/u;
2121

2222
const RELATIVE_FILE_NAME_PATTERN =
23-
/^[A-Za-z0-9._-]+(?: +[A-Za-z0-9._-]+)*\.[A-Za-z0-9_-]+(?::\d+){0,2}$/;
23+
/^[\p{L}\p{N}\p{M}._-]+(?: +[\p{L}\p{N}\p{M}._-]+)*\.[A-Za-z0-9_-]+(?::\d+){0,2}$/u;
2424

2525
const EXTERNAL_SCHEME_PATTERN = /^([A-Za-z][A-Za-z0-9+.-]*):(.*)$/;
2626

0 commit comments

Comments
 (0)