Skip to content

Commit bc38940

Browse files
committed
fix: decode URI-encoded paths when opening local files
Markdown-it percent-encodes non-ASCII characters in link hrefs (e.g. Chinese/Japanese/Korean filenames). The openFile handler passed these encoded paths directly to Utils.joinPath, resulting in file-not-found errors. Apply decodeURIComponent before constructing the file URI. Fixes markmap#73
1 parent 7234f1b commit bc38940

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/extension.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,8 @@ class MarkmapEditor implements CustomTextEditorProvider {
318318
await writeFile(targetUri, data.content);
319319
},
320320
openFile(relPath: string) {
321-
const filePath = Utils.joinPath(Utils.dirname(document.uri), relPath);
321+
const decoded = decodeURIComponent(relPath);
322+
const filePath = Utils.joinPath(Utils.dirname(document.uri), decoded);
322323
commands.executeCommand('vscode.open', filePath);
323324
},
324325
async setFocus(line: number) {

0 commit comments

Comments
 (0)