Skip to content
This repository has been archived by the owner on Mar 15, 2024. It is now read-only.

Commit

Permalink
Fix mobile + url encoding issue (#1510)
Browse files Browse the repository at this point in the history
(cherry picked from commit 6e8c15b)
  • Loading branch information
MGibson1 committed Mar 2, 2022
1 parent aa42890 commit 90097b9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/connectors/captcha.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ async function start() {

let decodedData: any;
try {
decodedData = JSON.parse(b64Decode(data));
decodedData = JSON.parse(b64Decode(data, true));
} catch (e) {
error("Cannot parse data.");
return;
Expand Down
6 changes: 5 additions & 1 deletion src/connectors/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ export function getQsParam(name: string) {
return decodeURIComponent(results[2].replace(/\+/g, " "));
}

export function b64Decode(str: string) {
export function b64Decode(str: string, spaceAsPlus = false) {
if (spaceAsPlus) {
str = str.replace(/ /g, "+");
}

return decodeURIComponent(
Array.prototype.map
.call(atob(str), (c: string) => {
Expand Down

0 comments on commit 90097b9

Please sign in to comment.