Fixed file corruption when AgentPong is used.
This commit is contained in:
parent
7f5b113c26
commit
8355fd0613
|
@ -1100,8 +1100,10 @@ function createMeshCore(agent) {
|
||||||
|
|
||||||
// If this is upload data, save it to file
|
// If this is upload data, save it to file
|
||||||
if (this.httprequest.uploadFile) {
|
if (this.httprequest.uploadFile) {
|
||||||
|
if (typeof data == 'object') {
|
||||||
try { fs.writeSync(this.httprequest.uploadFile, data); } catch (e) { this.write(new Buffer(JSON.stringify({ action: 'uploaderror' }))); return; } // Write to the file, if there is a problem, error out.
|
try { fs.writeSync(this.httprequest.uploadFile, data); } catch (e) { this.write(new Buffer(JSON.stringify({ action: 'uploaderror' }))); return; } // Write to the file, if there is a problem, error out.
|
||||||
this.write(new Buffer(JSON.stringify({ action: 'uploadack', reqid: this.httprequest.uploadFileid }))); // Ask for more data
|
this.write(new Buffer(JSON.stringify({ action: 'uploadack', reqid: this.httprequest.uploadFileid }))); // Ask for more data
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -6915,7 +6915,7 @@
|
||||||
var p13filetreelocation = [];
|
var p13filetreelocation = [];
|
||||||
|
|
||||||
function p13gotFiles(data) {
|
function p13gotFiles(data) {
|
||||||
if ((data.length > 0) && (data.charCodeAt(0) != 123)) { p13gotDownloadBinaryData(data); return; }
|
if ((data.length > 0) && (data.charCodeAt(0) != 123)) { p13gotDownloadBinaryData(data); return; } // This is ok because 4 first bytes is a control value.
|
||||||
//console.log('p13gotFiles', data);
|
//console.log('p13gotFiles', data);
|
||||||
data = JSON.parse(decode_utf8(data));
|
data = JSON.parse(decode_utf8(data));
|
||||||
if (data.action == 'download') { p13gotDownloadCommand(data); return; }
|
if (data.action == 'download') { p13gotDownloadCommand(data); return; }
|
||||||
|
|
Loading…
Reference in New Issue