-
-
Notifications
You must be signed in to change notification settings - Fork 221
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(sourcebundle): Skip non-UTF8 files #2109
Conversation
src/utils/file_upload.rs
Outdated
if let Err(e) = bundle.add_file(bundle_path, file.contents.as_slice(), info) { | ||
if e.kind() == SourceBundleErrorKind::ReadFailed { | ||
// This is a non-UTF8 file; it might be an asset which is not intended for inclusion in the | ||
// sourcebundle. We silently skip it. |
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.
Let's add an info
log to inform users that we are skipping the file
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.
Ideally with the file path, something like:
skipping file path/to/file because it is not UTF-8 encoded
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.
Looks good!
Prompted by #2107 and #2108.
This matches on the error kind returned by
SourceBundleWriter::add_file
and silently skipsReadFailed
errors, which happen on files that aren't valid UTF8. Errors like this are likely caused by asset files that weren't intended to be included in the bundle anyway. It might also make sense to log that we're skipping the file, though.