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

Fix base64 padding with multiple =-signs. An equal amount of dots is … #186

Merged
merged 1 commit into from
Oct 11, 2016

Conversation

SjonHortensius
Copy link
Contributor

@SjonHortensius SjonHortensius commented Oct 3, 2016

…required in output

instead of merging all =-signs into one dot, which can then not be decoded. Test string:

SELECT * from version where "isHelper" order by "order" desc;

will be encode to

U0VMRUNUICogZnJvbSB2ZXJzaW9uICB3aGVyZSAiaXNIZWxwZXIiIG9yZGVyIGJ5ICJvcmRlciIgZGVzYw.

missing a dot at the end making it undecodable.

Since =-signs only appear at the end anyway, we don't need the explicit '$' in the regexp

…required in output

instead of merging all =-signs into one dot, which can then not be
decoded. Test string:

SELECT * from version  where "isHelper" order by "order" desc

will be encode to

U0VMRUNUICogZnJvbSB2ZXJzaW9uICB3aGVyZSAiaXNIZWxwZXIiIG9yZGVyIGJ5ICJvcmRlciIgZGVzYw.

missing a dot at the end making it undecodable.

Since =-signs only appear at the end anyway, we don't need the explicit
'$' in the regexp
@sosedoff
Copy link
Owner

sosedoff commented Oct 4, 2016

I'll look into this. Base64 was not really a good choice so it'll be replaced with something more robust in near future.

@SjonHortensius
Copy link
Contributor Author

Maybe; but the currently implementation is broken and my commit fixes it.
If you include this fix; there is less need for an alternative solution imo

@sosedoff
Copy link
Owner

sosedoff commented Oct 7, 2016

Im more that happy to merge this PR, could you please include a few example queries that did not work for you. I tried the query you provided and it went through just fine (no issues with decoding).
Also, which pgweb version are you on?

@SjonHortensius
Copy link
Contributor Author

It seems a ; fell off, added that to my initial comment. I'm using the latest release, 0.9.5

Providing additional queries is difficult as I cannot predict when multiple padding-chars are added

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

Successfully merging this pull request may close these issues.

2 participants