Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decoder should replace all #11

Open
michaelkantor opened this issue Jun 28, 2017 · 0 comments
Open

Decoder should replace all #11

michaelkantor opened this issue Jun 28, 2017 · 0 comments

Comments

@michaelkantor
Copy link

I'm not a user, but I did notice and copy your url_base64_decoder for a project of my own. I've noticed the following issue with it which you may want to fix:

https://github.com/auth0-blog/angular-token-auth/blob/master/auth.client.js#L5:

var output = str.replace('-', '+').replace('_', '/');

should in fact be doing a replace All:

const reg1 = new RegExp("_", "g");
const reg2 = new RegExp("-", "g");
let output = str.replace(reg2, '+').replace(reg1, '/');

Clarification: There is nothing limiting a string to a single "_" or "-" character.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant