Skip to content

Commit

Permalink
fix: #572
Browse files Browse the repository at this point in the history
  • Loading branch information
MliKiowa committed Nov 28, 2024
1 parent 1dc2f7e commit 3bb12e3
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/common/file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,10 +198,19 @@ export async function checkUriType(Uri: string) {
if (uri.startsWith('base64:')) {
return { Uri: uri, Type: FileUriType.Base64 };
}
// 默认file://
if (uri.startsWith('file:')) {
const filePath: string = uri.slice(7);
// 兼容file:///
// file:///C:/1.jpg
if (uri.startsWith('file:///') && process.platform === 'win32') {
const filePath: string = uri.slice(8);
return { Uri: filePath, Type: FileUriType.Local };
}
// 处理默认规范
// file://C:\1.jpg
// file:///test/1.jpg
const filePath: string = uri.slice(7);

return { Uri: filePath, Type: FileUriType.Local };
}
if (uri.startsWith('data:')) {
Expand Down

0 comments on commit 3bb12e3

Please sign in to comment.