Skip to content

Commit

Permalink
new version fixing regEx error and HTML entities in get parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
pmeisen committed Apr 25, 2019
1 parent bd165a1 commit af2ebe7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/Breinify.js
Original file line number Diff line number Diff line change
Expand Up @@ -309,9 +309,9 @@
return null;
} else if (value.charAt(0) === '.') {
base64 = value.substr(1)
.replace('/~/g', '+')
.replace('/-/g', '/')
.replace('/_/g', '=');
.replace(/~/g, '+')
.replace(/-/g, '/')
.replace(/_/g, '=');
} else {
base64 = decodeURIComponent(value);
}
Expand Down
9 changes: 8 additions & 1 deletion src/BreinifyUtil.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,14 @@
loc: {

params: function (paramListSeparator, paramSeparator, paramSplit, url) {
url = typeof url === 'string' ? url : this.url();

// if the url is not passed in we use a special decoding for HTML entities
// to avoid this, just pass in the url
if (typeof url !== 'string') {
var decoder = document.createElement('textarea');
decoder.innerHTML = this.url();
url = decoder.value;
}

paramListSeparator = typeof paramListSeparator === 'string' ? paramListSeparator : '?';
paramSeparator = typeof paramSeparator === 'string' ? paramSeparator : '&';
Expand Down

0 comments on commit af2ebe7

Please sign in to comment.