Skip to content

Commit

Permalink
daemon: fix some bugs in the frontend js
Browse files Browse the repository at this point in the history
  • Loading branch information
wgreenberg committed Oct 8, 2024
1 parent 3a97d24 commit dbdeb81
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions bin/static/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,15 @@ async function updateAnalysisStatus(qmdlManifest) {
}

function parseNewlineDelimitedJSON(inputStr) {
if(! inputStr.includes("{")) {
inputStr = atob(inputStr).replaceAll("}{", "}\n{")
}
const lines = inputStr.split('\n');
const result = [];
let currentLine = '';
while (lines.length > 0) {
currentLine = lines.shift();
currentLine += lines.shift();
try {
const entry = JSON.parse(currentLine);
result.push(entry);
currentLine = '';
// if this chunk wasn't valid JSON, there was an escaped newline in the
// JSON line, so simply continue to the next one
} catch (e) {}
Expand Down

0 comments on commit dbdeb81

Please sign in to comment.