瀏覽代碼

Update blob.ts

zsviczian 5 月之前
父節點
當前提交
0aa2608799
共有 1 個文件被更改,包括 1 次插入18 次删除
  1. 1 18
      packages/excalidraw/data/blob.ts

+ 1 - 18
packages/excalidraw/data/blob.ts

@@ -107,19 +107,6 @@ export const isImageFileHandle = (handle: FileSystemHandle | null) => {
   return type === "png" || type === "svg";
 };
 
-const getExtensionFromFilename = (filename?: string): string | null => {
-  if (!filename) {
-    return null;
-  }
-  const ext = filename.split(".").pop()?.toLowerCase();
-  return ext || null;
-};
-
-const isSupportedExtension = (filename?: string) => {
-  const extension = getExtensionFromFilename(filename);
-  return !!extension && extension in IMAGE_MIME_TYPES;
-};
-
 export const isSupportedImageFileType = (type: string | null | undefined) => {
   return !!type && (Object.values(IMAGE_MIME_TYPES) as string[]).includes(type);
 };
@@ -128,11 +115,7 @@ export const isSupportedImageFile = (
   blob: Blob | null | undefined,
 ): blob is Blob & { type: ValueOf<typeof IMAGE_MIME_TYPES> } => {
   const { type } = blob || {};
-  if (type) {
-    return isSupportedImageFileType(type);
-  }
-  const { name } = blob || {};
-  return isSupportedExtension(name);
+  return isSupportedImageFileType(type);
 };
 
 export const loadSceneOrLibraryFromBlob = async (