Skip to content

Commit

Permalink
BUGFIX #119: Recipe names are now correctly escaped.
Browse files Browse the repository at this point in the history
  • Loading branch information
n1474335 committed Apr 24, 2017
1 parent 0f02fb5 commit 4375a15
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/web/ControlsWaiter.js
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ ControlsWaiter.prototype.loadClick = function() {
* Saves the recipe specified in the save textarea to local storage.
*/
ControlsWaiter.prototype.saveButtonClick = function() {
var recipeName = document.getElementById("save-name").value,
var recipeName = Utils.escapeHtml(document.getElementById("save-name").value),
recipeStr = document.getElementById("save-text").value;

if (!recipeName) {
Expand Down Expand Up @@ -288,7 +288,8 @@ ControlsWaiter.prototype.populateLoadRecipesList = function() {
for (i = 0; i < savedRecipes.length; i++) {
var opt = document.createElement("option");
opt.value = savedRecipes[i].id;
opt.innerHTML = savedRecipes[i].name;
// Unescape then re-escape in case localStorage has been corrupted
opt.innerHTML = Utils.escapeHtml(Utils.unescapeHtml(savedRecipes[i].name));

loadNameEl.appendChild(opt);
}
Expand Down

0 comments on commit 4375a15

Please sign in to comment.