Skip to content

Commit

Permalink
encodeURI for cases when it was not alreay done
Browse files Browse the repository at this point in the history
  • Loading branch information
molotgor committed Apr 23, 2024
1 parent 0835687 commit e035dae
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ interface Props {
export default function SimpleMessageRaw({ rawContent }: Props) {
const contentRef = React.useRef<HTMLDivElement>(null);

const humanReadableContent = decodeURIComponent(atob(rawContent));
const humanReadableContent = decodeURIComponent(encodeURIComponent(atob(rawContent)));
const convertedArr = splitOnReadableParts(humanReadableContent);

return (
Expand Down
4 changes: 3 additions & 1 deletion src/helpers/rawFormatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@ export function decodeBase64RawContent(rawBase64Content: string): string[][] {
const offset = [];
const hexadecimal = [];
const humanReadable = [];
const raw = Uint16Array.from(decodeURIComponent(atob(rawBase64Content)), c => c.charCodeAt(0));
const raw = Uint16Array.from(decodeURIComponent(encodeURIComponent(atob(rawBase64Content))), c =>
c.charCodeAt(0),
);
let index = 0;
const { length } = raw;
while (index < length) {
Expand Down

0 comments on commit e035dae

Please sign in to comment.