Fix usage of wrong streaming buffer in frontend

This commit is contained in:
James 2018-08-07 15:39:24 +10:00 committed by James Lonie
parent b32e9f6f33
commit d4dd3fb182

View File

@ -77,14 +77,12 @@ function stream_ajax(path, callback, successCallback, failCallback, data) {
req.onreadystatechange = function() { req.onreadystatechange = function() {
if(req.readyState > 2) { if(req.readyState > 2) {
var newData = req.responseText.substr(req.seenBytes); buffer += req.responseText.substr(req.seenBytes);
buffer += newData;
var pointer; var pointer;
while ((pointer = newData.indexOf("\n")) >= 0) { while ((pointer = buffer.indexOf("\n")) >= 0) {
var line = newData.substring(0, pointer).trim(); var line = buffer.substring(0, pointer).trim();
newData = newData.substring(pointer + 1); buffer = buffer.substring(pointer + 1);
if (line.length === 0) { if (line.length === 0) {
continue; continue;