From 2ee0fed047bfac889956b67889fd6a56db9823e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9E=97=E5=B0=8F=E6=A7=90?= <1007028430.stapx@gmail.com> Date: Thu, 7 Nov 2024 16:10:59 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=9C=A8=E5=A4=84=E7=90=86=20file=20uri?= =?UTF-8?q?=20=E6=97=B6=E5=8F=AF=E8=83=BD=E4=BC=9A=E6=84=8F=E5=A4=96?= =?UTF-8?q?=E5=BF=BD=E7=95=A5=20fragment=20=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 在处理类似 C:\\test\\test#1.txt 时 #1.txt 由于为 url fragment 而被意外截断 --- src/common/file.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common/file.ts b/src/common/file.ts index 4fb308a4..6a2e8e8b 100644 --- a/src/common/file.ts +++ b/src/common/file.ts @@ -215,7 +215,7 @@ export async function checkUriType(Uri: string) { } if (uri.startsWith('file://')) { let filePath: string; - const pathname = decodeURIComponent(new URL(uri).pathname); + const pathname = decodeURIComponent(new URL(uri).pathname + new URL(uri).hash); if (process.platform === 'win32') { filePath = pathname.slice(1); } else {