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

Padding is removed from base64 encoded values. #10

Open
wollardj opened this issue Jan 11, 2015 · 0 comments
Open

Padding is removed from base64 encoded values. #10

wollardj opened this issue Jan 11, 2015 · 0 comments

Comments

@wollardj
Copy link

I believe this line is causing the issue, which is basically that the base64 padding at the end of a string (==) is being removed from the value.

So (using bogus base64 value for point), you might expect ?data=DgxfQ== to produce {data: 'DgxfQ=='}, but instead it produces {data: 'DgxfQ'}.

Instead of pair.split('='), perhaps something like this would work more reliably, though I suspect it's a bit more expensive:

idx = pair.indexOf('=');
key = pair.substr(0, idx);
value = pair.substr(idx+1);

I'd hoped pair.split('=', 2) would do the trick, but that truncates the trailing == as well.

...has anyone thanked you for your work recently? Either way, many thanks ;)

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