Skip to content

Commit

Permalink
file type detector: fix jpeg detection
Browse files Browse the repository at this point in the history
  • Loading branch information
ItsPi3141 committed Jun 11, 2024
1 parent e3fcac4 commit 11c55b2
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions ffmpeg/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ export function getMimeTypeFromArrayBuffer(/** @type {Uint8Array | ArrayBuffer}
for (let i = 0; i < len; i++) signatureArr[i] = uint8arr[i].toString(16);
const signature = signatureArr.join("").toUpperCase();

switch (signature) {
case "89504E47":
switch (true) {
case signature === "89504E47":
return "image/png";
case "47494638":
case signature === "47494638":
return "image/gif";
case "FFD8FFDB":
case "FFD8FFE0":
case signature.startsWith("FFD8FF"):
return "image/jpeg";
default:
console.log("Unknown type. Signature:", signature);
return null;
}
}
Expand Down

0 comments on commit 11c55b2

Please sign in to comment.