Skip to content

Commit

Permalink
Improve WebM detection (#486)
Browse files Browse the repository at this point in the history
  • Loading branch information
Borewit committed Sep 1, 2021
1 parent d556d4e commit b23be62
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion core.js
Expand Up @@ -736,7 +736,8 @@ async function _fromTokenizer(tokenizer) {
while (children > 0) {
const element = await readElement();
if (element.id === 0x42_82) {
return tokenizer.readToken(new Token.StringType(element.len, 'utf-8')); // Return DocType
const rawValue = await tokenizer.readToken(new Token.StringType(element.len, 'utf-8'));
return rawValue.replace(/\00.*$/g, ''); // Return DocType
}

await tokenizer.ignore(element.len); // ignore payload
Expand Down
Binary file added fixture/fixture-null.webm
Binary file not shown.
3 changes: 3 additions & 0 deletions test.js
Expand Up @@ -203,6 +203,9 @@ const names = {
'fixture-fast-web', // PDF saved from Adobe Illustrator, using the default "[Illustrator Default"] preset, but enabling "Optimize for Fast Web View"
'fixture-printed', // PDF printed from Adobe Illustrator, but with a PDF printer.
],
webm: [
'fixture-null', // EBML DocType with trailing null character
],
};

// Define an entry here only if the file type has potential
Expand Down

0 comments on commit b23be62

Please sign in to comment.