Merge pull request #661 from kiwix/javascript_quotting_fix

Fix javascript/DOM quotting bug
This commit is contained in:
Kelson 2021-12-19 11:33:43 +01:00 committed by GitHub
commit a89924a23f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -51,7 +51,7 @@
fileSize /= (1000 ** quotient);
return `${+fileSize.toFixed(2)} ${units[quotient]}`;
};
const humanFriendlyTitle = (title) => {
title = title.replace(/_/g, ' ');
return htmlEncode(title[0].toUpperCase() + title.slice(1));
@ -229,7 +229,7 @@
data.querySelectorAll('entry').forEach(entry => {
const title = getInnerHtml(entry, 'title');
const value = getInnerHtml(entry, valueEntryNode);
optionStr += `<option value='${value}">${humanFriendlyTitle(title)}</option>`;
optionStr += `<option value="${value}">${humanFriendlyTitle(title)}</option>`;
});
document.querySelector(nodeQuery).innerHTML += optionStr;
});