Skip to content

Commit

Permalink
Fixed bug in firefox where recipes containing an = character would no…
Browse files Browse the repository at this point in the history
…t load from the URL
  • Loading branch information
n1474335 committed Jul 12, 2017
1 parent 645e540 commit 2555de7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/core/Utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -1000,9 +1000,14 @@ const Utils = {
if (paramStr === "") return {};

// Cut off ? or # and split on &
const params = paramStr.substr(1).split("&");
if (paramStr[0] === "?" ||
paramStr[0] === "#") {
paramStr = paramStr.substr(1);
}

const params = paramStr.split("&");
const result = {};

for (let i = 0; i < params.length; i++) {
const param = params[i].split("=");
if (param.length !== 2) {
Expand Down
7 changes: 6 additions & 1 deletion src/web/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,12 @@ App.prototype.addFavourite = function(name) {
*/
App.prototype.loadURIParams = function() {
// Load query string or hash from URI (depending on which is populated)
const params = window.location.search || window.location.hash;
// We prefer getting the hash by splitting the href rather than referencing
// location.hash as some browsers (Firefox) automatically URL decode it,
// which cause issues.
const params = window.location.search ||
window.location.href.split("#")[1] ||
window.location.hash;
this.uriParams = Utils.parseURIParams(params);

// Pause auto-bake while loading but don't modify `this.autoBake_`
Expand Down

0 comments on commit 2555de7

Please sign in to comment.