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

Emoji string fails to decode #152

Closed
bbhtt opened this issue Nov 5, 2023 · 3 comments Β· Fixed by #153
Closed

Emoji string fails to decode #152

bbhtt opened this issue Nov 5, 2023 · 3 comments Β· Fixed by #153
Labels

Comments

@bbhtt
Copy link

bbhtt commented Nov 5, 2023

Hello any idea why this string fails to decode?

πŸ™‹, 🌍!\n…

It seems to work fine on command line echo "8J+Ziywg8J+MjSEK4oCm"|base64 --decode but https://httpbingo.org/base64/decode/8J+Ziywg8J+MjSEK4oCm returns an error.

I guess it rejects certain encodes?

@mccutchen
Copy link
Owner

The problem here is that go-httpbin only accepts the URL-safe base64 encoding, though the error does not make that obvious.

Fixing in #153.

mccutchen added a commit that referenced this issue Nov 5, 2023
#153)

As reported in #152, the `/base64` endpoint can only decode the
"URL-safe" base64 encoding, but the error it returns is not very useful
if you're not already familiar with different base64 encoding variants.

Here we follow [Postel's law][1] and accept either the URL-safe or
standard encodings, while continuing to use the URL-safe variant
when encoding ourselves.

Fixes #152.

[1]: https://en.wikipedia.org/wiki/Robustness_principle
@mccutchen
Copy link
Owner

Fix released in v2.12.0, and deployed to https://httpbingo.org.

Your test case now works as expected:

$ curl 'https://httpbingo.org/base64/decode/8J+Ziywg8J+MjSEK4oCm'
πŸ™‹, 🌍!
…

Thanks for the report @bbhtt!

@bbhtt
Copy link
Author

bbhtt commented Nov 5, 2023

Thanks!

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

Successfully merging a pull request may close this issue.

2 participants