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: judge file format by server's content-type header #125
Conversation
related to #106 |
It looks like the error is caused by the warning:
switch the project to a shorter folder, all tests is passed. |
const contentType = download.headers['content-type']; | ||
const isZip = contentType ? contentType === 'application/zip' : url.endsWith('.zip'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const contentType = download.headers['content-type']; | |
const isZip = contentType ? contentType === 'application/zip' : url.endsWith('.zip'); | |
const isZip = download.headers['content-type'] === 'application/zip' ?? url.endsWith('.zip'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
download.headers['content-type'] === 'application/zip'
is always true
or false
, so url.endsWith('.zip')
will never be reached.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, right. Nevermind then 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for looking into this! Not sure why it didn't cause issues on my machine. One small cleanup comment
Co-authored-by: Connor Peet <connor@peet.io>
No description provided.