Skip to content

Commit

Permalink
Fix unicode user name showing as gibberish (#876)
Browse files Browse the repository at this point in the history
  • Loading branch information
feedmeapples committed Oct 11, 2022
1 parent 44ba5ed commit 8904275
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/lib/utilities/get-auth-user-cookie.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { browser } from '$app/env';
import { atob } from '$lib/utilities/atob';

type UserResponse = {
AccessToken: string;
Expand Down Expand Up @@ -28,7 +29,7 @@ export const getAuthUserCookie = (isBrowser = browser): User => {

if (userBase64) {
try {
const userS = decodeB64(userBase64);
const userS = atob(userBase64);
const user: UserResponse = JSON.parse(userS);

return {
Expand All @@ -45,7 +46,3 @@ export const getAuthUserCookie = (isBrowser = browser): User => {

return {};
};

function decodeB64(str) {
return decodeURIComponent(atob(str));
}

2 comments on commit 8904275

@vercel
Copy link

@vercel vercel bot commented on 8904275 Oct 11, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

ui – ./

ui-lyart.vercel.app
ui-git-main.preview.thundergun.io
ui.preview.thundergun.io

@vercel
Copy link

@vercel vercel bot commented on 8904275 Oct 11, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

holocene – ./

holocene-git-main.preview.thundergun.io
holocene.preview.thundergun.io

Please sign in to comment.