refactor: 提高解析兼容

This commit is contained in:
手瓜一十雪 2024-11-28 10:41:51 +08:00
parent 9fcfb5493c
commit 2531b08538

View File

@ -195,11 +195,13 @@ export async function checkUriType(Uri: string) {
return { Uri: uri, Type: FileUriType.Remote }; return { Uri: uri, Type: FileUriType.Remote };
} }
// 再判断是否是Base64 // 再判断是否是Base64
if (uri.startsWith('base64://')) { if (uri.startsWith('base64:')) {
return { Uri: uri, Type: FileUriType.Base64 }; return { Uri: uri, Type: FileUriType.Base64 };
} }
if (uri.startsWith('file://')) { if (uri.startsWith('file:')) {
let filePath: string = uri.slice(7); let filePath: string = uri.slice(7);
// file://C:\1.jpg
// file:///test/1.jpg
return { Uri: filePath, Type: FileUriType.Local }; return { Uri: filePath, Type: FileUriType.Local };
} }
if (uri.startsWith('data:')) { if (uri.startsWith('data:')) {