Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix detection .png with long iTXt chunk #321

Merged
merged 1 commit into from
Feb 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions core.js
Original file line number Diff line number Diff line change
Expand Up @@ -885,6 +885,11 @@ async function _fromTokenizer(tokenizer) {
await tokenizer.ignore(chunk.length + 4); // Ignore chunk-data + CRC
}
} while (tokenizer.position < tokenizer.fileInfo.size);

return {
ext: 'png',
mime: 'image/png'
};
}

if (check([0x41, 0x52, 0x52, 0x4F, 0x57, 0x31, 0x00, 0x00])) {
Expand Down
Binary file added fixture/fixture-itxt.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,10 @@ const names = {
'fixture-big-endian',
'fixture-little-endian'
],
png: [
'fixture',
'fixture-itxt'
],
tar: [
'fixture',
'fixture-v7'
Expand Down