Fix read_file returning extra zero bytes at the end
This commit is contained in:
parent
c819dec03f
commit
e21ae4a37f
|
@ -980,7 +980,7 @@
|
||||||
var filename = this.value.replace(/\/$/, "").split("/");
|
var filename = this.value.replace(/\/$/, "").split("/");
|
||||||
filename = filename[filename.length - 1] || "root";
|
filename = filename[filename.length - 1] || "root";
|
||||||
|
|
||||||
dump_file(uint8array.buffer, filename);
|
dump_file(uint8array, filename);
|
||||||
this.value = "";
|
this.value = "";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -797,10 +797,19 @@ V86Starter.prototype.read_file = function(file, callback)
|
||||||
{
|
{
|
||||||
fs.OpenInode(id, undefined);
|
fs.OpenInode(id, undefined);
|
||||||
fs.AddEvent(
|
fs.AddEvent(
|
||||||
id,
|
id,
|
||||||
function()
|
function()
|
||||||
{
|
{
|
||||||
callback(null, fs.inodedata[id]);
|
var data = fs.inodedata[id];
|
||||||
|
|
||||||
|
if(data)
|
||||||
|
{
|
||||||
|
callback(null, data.subarray(0, fs.inodes[id].size));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
callback(new FileNotFoundError(), null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue