Fix: manga preview throw alwaysfaulty error

This commit is contained in:
Arief Rachmawan
2024-10-05 07:34:07 +07:00
committed by GitHub
parent 2ddd058579
commit b8ad5ad890
+1 -1
View File
@@ -100,7 +100,7 @@ export default function PreviewManga({ file }: Props) {
file.ondata = (err, data, final) => {
if (err) throw err;
// Check if the file is an image
if (!file.name.toLowerCase().includes(".jpg" || ".jpeg" || ".png" || ".gif" || ".webp")) return;
if (![".jpg", ".jpeg", ".png", ".gif", ".webp"].some(ext => file.name.toLowerCase().endsWith(ext))) return;
if (!final) return; // Skip if not fully loaded
const blob = new Blob([data]);