Skip to content

Commit

Permalink
Fixed 'Save recipe' URL generation issue. Closes #1176
Browse files Browse the repository at this point in the history
  • Loading branch information
n1474335 committed Feb 16, 2021
1 parent 22fe5a6 commit c879af6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/core/Utils.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/web/App.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -725,7 +725,7 @@ class App {
this.progress = 0;
this.autoBake();

this.updateTitle(false, null, true);
this.updateTitle(true, null, true);
}


Expand Down
6 changes: 4 additions & 2 deletions src/web/waiters/ControlsWaiter.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
}
}

Expand Down

0 comments on commit c879af6

Please sign in to comment.