From c01b2308b36c3940431eb25045960aa10b92ea79 Mon Sep 17 00:00:00 2001 From: Borewit Date: Sun, 8 Sep 2024 12:32:40 +0200 Subject: [PATCH] Reorder ACE signature check (#669) --- core.js | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/core.js b/core.js index 81787c3d..8f4aa425 100644 --- a/core.js +++ b/core.js @@ -1129,16 +1129,6 @@ export class FileTypeParser { }; } - if (this.checkString('**ACE', {offset: 7})) { - await tokenizer.peekBuffer(this.buffer, {length: 14, mayBeLess: true}); - if (this.checkString('**', {offset: 12})) { - return { - ext: 'ace', - mime: 'application/x-ace-compressed', - }; - } - } - if ( this.checkString('WEBVTT') && ( @@ -1432,6 +1422,14 @@ export class FileTypeParser { }; } + // ACE: requires 14 bytes in the buffer + if (this.checkString('**ACE', {offset: 7}) && this.checkString('**', {offset: 12})) { + return { + ext: 'ace', + mime: 'application/x-ace-compressed', + }; + } + // -- 15-byte signatures -- if (this.checkString('BEGIN:')) {