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

Bug: Brotli cannot be detected based on magic bytes #52

Closed
NodyHub opened this issue Mar 28, 2024 · 0 comments · Fixed by #56
Closed

Bug: Brotli cannot be detected based on magic bytes #52

NodyHub opened this issue Mar 28, 2024 · 0 comments · Fixed by #56
Labels
bug Something isn't working

Comments

@NodyHub
Copy link
Collaborator

NodyHub commented Mar 28, 2024

The current implementation tries to detect brotli archives based on magic bytes:

A test has shown that the listed magic bytes cannot be used to detect every compressed archive:

~/tmp/goextract-test% date > test
~/tmp/goextract-test% brotli test
~/tmp/goextract-test% ll
total 16
-rw-r--r--  1 jan  staff    29B Mar 28 14:51 test
-rw-r--r--  1 jan  staff    34B Mar 28 14:51 test.br
~/tmp/goextract-test% rm test
test
~/tmp/goextract-test% goextract test.br
2024/03/28 14:51:32 error during extraction: archive type not supported
~/tmp/goextract-test% xxd test.br
00000000: 2170 0004 5468 7520 4d61 7220 3238 2031  !p..Thu Mar 28 1
00000010: 343a 3531 3a31 3420 4345 5420 3230 3234  4:51:14 CET 2024
00000020: 0a03

A further investigation revealed that the designer of brotli do not consider adding magic bytes to the algorithm:
google/brotli#298 (comment)

We need to adjust the brotli detection to be based in file extension.

@NodyHub NodyHub added the bug Something isn't working label Mar 28, 2024
@NodyHub NodyHub linked a pull request Apr 2, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant