From 4f770f26ce117e05fb18d45704a8c9011047bc0b Mon Sep 17 00:00:00 2001 From: Patrick Farwick <9168045+MinecraftPlaye@users.noreply.github.com> Date: Sat, 22 Jan 2022 21:17:57 +0000 Subject: [PATCH] Ignore files which do not have a file extension --- src/plugins/comicsPlayer/plugin.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/plugins/comicsPlayer/plugin.js b/src/plugins/comicsPlayer/plugin.js index 6f53d2878..139704f69 100644 --- a/src/plugins/comicsPlayer/plugin.js +++ b/src/plugins/comicsPlayer/plugin.js @@ -241,6 +241,9 @@ export class ComicsPlayer { } } +// the comic book archive supports any kind of image format as it's just a zip archive +const supportedFormats = ['jpg', 'png', 'avif', 'gif', 'bmp', 'dib', 'tiff', 'tif']; + class ArchiveSource { constructor(url) { this.url = url; @@ -259,14 +262,11 @@ class ArchiveSource { this.raw = await this.archive.getFilesArray(); await this.archive.extractFiles(); - // the comic book archive supports any kind of image format as it's just a zip archive - const supportedFormats = ['jpg', 'png', 'avif', 'gif', 'bmp', 'dib', 'tiff', 'tif']; - let files = await this.archive.getFilesArray(); files = files.filter((file) => { const name = file.file.name; const index = name.lastIndexOf('.'); - return supportedFormats.includes(name.substr(index + 1)); + return index !== 1 && supportedFormats.includes(name.slice(index + 1)); }); files.sort((a, b) => { if (a.file.name < b.file.name) {