Closed
Bug 1894632
Opened 1 year ago
Closed 1 year ago
non-UTF-8 files are shown as 0 bytes
Categories
(Webtools :: Searchfox, defect)
Webtools
Searchfox
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: arai, Assigned: arai)
Details
Attachments
(1 file)
The filesize in the directory listing is calculated in the following code, which expects the file content being UTF-8.
If the file content is not UTF-8, or simply binary, it takes Err(_) => (None, 0), path and the filesize is shown as 0 bytes.
let (description, file_size) = match fs::read_to_string(&raw_file_path) {
Ok(contents) => {
...
(Some(description), metadata.len())
}
None => (None, metadata.len()),
}
}
Err(_) => (None, 0),
};
example: TwemojiMozilla.ttf in https://searchfox.org/mozilla-central/source/browser/fonts says it's 0 bytes.
The file size calculation actually doesn't depend on the file content.
Unless there's any issue with accessing the binary file metadata, the calculation for the description and the file size can be done separately, so that binary file's size becomes correct value.
| Assignee | ||
Comment 1•1 year ago
|
||
Assignee: nobody → arai.unmht
| Assignee | ||
Updated•1 year ago
|
Status: NEW → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•