add special case of 1 byte file being application/octet-stream

This commit is contained in:
joshuaboud 2021-10-04 13:19:03 -03:00
parent f269505719
commit 629e4d985a
No known key found for this signature in database
GPG Key ID: 17EFB59E2A8BF50E

View File

@ -93,7 +93,7 @@ export class NavFile extends NavEntry {
var fields = proc_output.split(/:(?=[^:]+$)/); // ensure it's the last : with lookahead
var type = fields[1].trim();
if ((/^text/.test(type) || /^inode\/x-empty$/.test(type) || this.stat["size"] === 0)) {
if (/^text/.test(type) || /^inode\/x-empty$/.test(type) || this.stat["size"] === 0 || (/^application\/octet-stream/.test(type) && this.stat["size"] === 1)) {
this.show_edit_file_contents();
} else {
console.log("Unknown mimetype: " + type);