-
Notifications
You must be signed in to change notification settings - Fork 5.2k
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
Don't crash when .mime file not exist in cache #1291
Conversation
8031e6b
to
d1aee8f
Compare
Not crashing is good, but it would be better to surface up the error instead of swallowing it, and to just check in the |
@kitsonk we can still infer the file type with extension though and we can either generate a new .mime file based on the extension or warn the user. But yeah missing .mime is indeed an issue (and might have some security implications?). Let's see @ry 's opinion on this... Honestly I don't really have some clear opinion/idea about this. But carrying around |
We want to respect the media type offered up the original server request. We cache locally each source file and use the file system to "index" each source file. The source file and the media type could be combined and cached together, but that actually adds more overhead with little value to re-parse it back out. So if we write out every individual source file, we write out every individual |
// Option<String> -> Option<&str> | ||
let maybe_content_type_str = | ||
maybe_content_type_string.as_ref().map(String::as_str); | ||
(source, map_content_type(&p, maybe_content_type_str)) |
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.
Is it possible to get a test below?
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.
Added
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.
Thank you
d1aee8f
to
612e5d5
Compare
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.
LGTM - it’s nice to see these niche cases ironed out :)
- Don't crash when .mime file not exist in cache (denoland#1291) - Process source maps in Rust instead of JS (denoland#1280) - Use alternate TextEncoder/TextDecoder implementation (denoland#1281) - Upgrade flatbuffers to 80d148 - Fix memory leaks (denoland#1265, denoland#1275)
This unblocks #1289 .
See #1289 (comment)
Tested locally, benchmark is working with this fix in place.