From c879af6860ca5fb91bf7249fd646f0be14898730 Mon Sep 17 00:00:00 2001 From: n1474335 Date: Tue, 16 Feb 2021 14:12:14 +0000 Subject: [PATCH] Fixed 'Save recipe' URL generation issue. Closes #1176 --- src/core/Utils.mjs | 4 ++-- src/web/App.mjs | 2 +- src/web/waiters/ControlsWaiter.mjs | 6 ++++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/core/Utils.mjs b/src/core/Utils.mjs index 2020545b..ed29ceba 100755 --- a/src/core/Utils.mjs +++ b/src/core/Utils.mjs @@ -895,8 +895,8 @@ class Utils { while ((m = recipeRegex.exec(recipe))) { // Translate strings in args back to double-quotes - args = m[2] - .replace(/"/g, '\\"') // Escape double quotes // lgtm [js/incomplete-sanitization] + args = m[2] // lgtm [js/incomplete-sanitization] + .replace(/"/g, '\\"') // Escape double quotes .replace(/(^|,|{|:)'/g, '$1"') // Replace opening ' with " .replace(/([^\\]|(?:\\\\)+)'(,|:|}|$)/g, '$1"$2') // Replace closing ' with " .replace(/\\'/g, "'"); // Unescape single quotes diff --git a/src/web/App.mjs b/src/web/App.mjs index 7fd876ac..04397a5f 100755 --- a/src/web/App.mjs +++ b/src/web/App.mjs @@ -725,7 +725,7 @@ class App { this.progress = 0; this.autoBake(); - this.updateTitle(false, null, true); + this.updateTitle(true, null, true); } diff --git a/src/web/waiters/ControlsWaiter.mjs b/src/web/waiters/ControlsWaiter.mjs index f252dfcd..5a9533f5 100755 --- a/src/web/waiters/ControlsWaiter.mjs +++ b/src/web/waiters/ControlsWaiter.mjs @@ -100,7 +100,7 @@ class ControlsWaiter { const includeRecipe = document.getElementById("save-link-recipe-checkbox").checked; const includeInput = document.getElementById("save-link-input-checkbox").checked; const saveLinkEl = document.getElementById("save-link"); - const saveLink = this.generateStateUrl(includeRecipe, includeInput, recipeConfig); + const saveLink = this.generateStateUrl(includeRecipe, includeInput, null, recipeConfig); saveLinkEl.innerHTML = Utils.escapeHtml(Utils.truncate(saveLink, 120)); saveLinkEl.setAttribute("href", saveLink); @@ -128,11 +128,13 @@ class ControlsWaiter { includeRecipe = includeRecipe && (recipeConfig.length > 0); // If we don't get passed an input, get it from the current URI - if (input === null) { + if (input === null && includeInput) { const params = this.app.getURIParams(); if (params.input) { includeInput = true; input = params.input; + } else { + includeInput = false; } }