Skip to content
This repository has been archived by the owner on Jul 19, 2024. It is now read-only.

Commit

Permalink
zip: use mime library
Browse files Browse the repository at this point in the history
  • Loading branch information
TurtleP committed Nov 8, 2023
1 parent 6f9d3c9 commit 69b6dbf
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/services/utilities.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const ImageTypes = ["image/png", "image/jpeg", "image/jpg"];
const FontTypes = ["font/ttf", "font/otf"];
const ZipTypes = ["application/x-zip-compressed", "application/zip"];

import mime from "mime";

Expand All @@ -14,7 +15,8 @@ export function isFontFile(file: File): boolean {
}

export function isZipFile(file: File): boolean {
return file.type === "application/x-zip-compressed";
const type: string | null = mime.getType(file.name);
return type != null && ZipTypes.includes(type);
}

export function isValidFile(file: File): boolean {
Expand Down

0 comments on commit 69b6dbf

Please sign in to comment.