Fix order for unzipped manga

This commit is contained in:
Shaun
2023-11-13 14:01:03 +09:00
parent 03370f1b9f
commit 5e7ec34300

View File

@@ -17,7 +17,19 @@ export async function unzipManga(file: File) {
const entries = await zipReader.getEntries(); const entries = await zipReader.getEntries();
const unzippedFiles: Record<string, File> = {}; const unzippedFiles: Record<string, File> = {};
for (const entry of entries) { const sortedEntries = entries.sort((a, b) => {
if (a.filename < b.filename) {
return -1;
}
if (a.filename > b.filename) {
return 1;
}
return 0;
})
for (const entry of sortedEntries) {
const mime = getMimeType(entry.filename); const mime = getMimeType(entry.filename);
if (imageTypes.includes(mime)) { if (imageTypes.includes(mime)) {
const blob = await entry.getData?.(new BlobWriter(mime)); const blob = await entry.getData?.(new BlobWriter(mime));