iron-meteor/iron-url

Padding is removed from base64 encoded values.

Opened this issue · 0 comments

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 ;)