fix: 在处理 file uri 时可能会意外忽略 fragment 段

在处理类似 C:\\test\\test#1.txt 时 #1.txt 由于为 url fragment 而被意外截断
This commit is contained in:
林小槐
2024-11-07 16:10:59 +08:00
committed by GitHub
parent 4787fa53b4
commit 2ee0fed047

View File

@@ -215,7 +215,7 @@ export async function checkUriType(Uri: string) {
} }
if (uri.startsWith('file://')) { if (uri.startsWith('file://')) {
let filePath: string; 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') { if (process.platform === 'win32') {
filePath = pathname.slice(1); filePath = pathname.slice(1);
} else { } else {