Skip to content

Commit

Permalink
Add base64 encoding/decoding for extra params when parameter name end…
Browse files Browse the repository at this point in the history
…s with `-b64` on `report` page
  • Loading branch information
lahmatiy committed Mar 1, 2021
1 parent 2305967 commit 90b7be2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## next

- Fixed extra params encoding on `report` page
- Added base64 encoding/decoding for extra params when parameter name ends with `-b64` on `report` page

## 1.0.0-beta.55 (17-02-2021)

Expand Down
9 changes: 7 additions & 2 deletions src/pages/report/params.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ export function encodeParams(params) {

Object.keys(extra || {}).sort().forEach(name => {
if (!specialParams.includes(name)) {
pairs.push([name, extra[name]]);
pairs.push([name, name.endsWith('-b64') && typeof extra[name] === 'string'
? base64.encode(extra[name])
: extra[name]
]);
}
});

Expand All @@ -51,7 +54,9 @@ export function decodeParams(pairs) {

Object.keys(params).forEach(name => {
if (!specialParams.includes(name)) {
decodedParams[name] = params[name];
decodedParams[name] = name.endsWith('-b64') && typeof params[name] === 'string'
? base64.decode(params[name])
: params[name];
}
});

Expand Down

0 comments on commit 90b7be2

Please sign in to comment.