1
0
mirror of https://github.com/bitwarden/web synced 2025-12-06 00:03:28 +00:00

Fix mobile + url encoding issue (#1510)

(cherry picked from commit 6e8c15bccd)
This commit is contained in:
Matt Gibson
2022-03-02 15:49:35 -05:00
parent aa42890fdf
commit 90097b9bef
2 changed files with 6 additions and 2 deletions

View File

@@ -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;

View File

@@ -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) => {