Skip to content

Commit 43d4885

Browse files
committed
feat(filevalidator.js): relax detection algorithm
1 parent 74820c4 commit 43d4885

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

filevalidator.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,15 @@ function(_) {
1111
// MPEG-1 Layer 3 file without an ID3 tag or with an ID3v1 tag (which's appended at the end of the file)
1212
[0xFF, 0xFB],
1313
// MP3 file with an ID3v2 container
14-
[0x49, 0x44, 0x33]
14+
[0x49, 0x44, 0x33],
15+
// Other MP3 files (FF Fx and FF Ex – they may cause false-positives)
16+
// Headers got from https://www.garykessler.net/library/file_sigs.html
17+
[0xFF, 0xE0], [0xFF, 0xE1], [0xFF, 0xE2], [0xFF, 0xE3], [0xFF, 0xE4],
18+
[0xFF, 0xE5], [0xFF, 0xE6], [0xFF, 0xE7], [0xFF, 0xE8], [0xFF, 0xE9],
19+
[0xFF, 0xEA], [0xFF, 0xEB], [0xFF, 0xEC], [0xFF, 0xED], [0xFF, 0xEE], [0xFF, 0xEF],
20+
[0xFF, 0xF0], [0xFF, 0xF1], [0xFF, 0xF2], [0xFF, 0xF3], [0xFF, 0xF4],
21+
[0xFF, 0xF5], [0xFF, 0xF6], [0xFF, 0xF7], [0xFF, 0xF8], [0xFF, 0xF9],
22+
[0xFF, 0xFA], [0xFF, 0xFB], [0xFF, 0xFC], [0xFF, 0xFD], [0xFF, 0xFE], [0xFF, 0xFF]
1523
],
1624
'wav': [
1725
// Waveform Audio File Format

0 commit comments

Comments
 (0)