Fixed exception when displaying large device file list.

This commit is contained in:
Ylian Saint-Hilaire 2020-08-25 10:28:56 -07:00
parent 12dc6b82fc
commit d6bdf2ca04
2 changed files with 8 additions and 2 deletions

File diff suppressed because one or more lines are too long

View File

@ -206,7 +206,13 @@ var CreateAgentRedirect = function (meshserver, module, serverPublicNamePort, au
obj.m.ProcessBinaryData(new Uint8Array(e.data)); obj.m.ProcessBinaryData(new Uint8Array(e.data));
} else { } else {
// Send as Text // Send as Text
obj.m.ProcessData(String.fromCharCode.apply(null, new Uint8Array(e.data))); if (e.data.byteLength < 16000) { // Process small data block
obj.m.ProcessData(String.fromCharCode.apply(null, new Uint8Array(e.data))); // This will stack overflow on Chrome with 100k+ blocks.
} else { // Process large data block
var bb = new Blob([new Uint8Array(e.data)]), f = new FileReader();
f.onload = function (e) { obj.m.ProcessData(e.target.result); };
f.readAsText(bb);
}
} }
} }
}; };