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(serving): fix cannot decode base64 encoded binary data #103

Merged
merged 5 commits into from
Jul 15, 2024

Conversation

cyclimse
Copy link
Collaborator

@cyclimse cyclimse commented Jul 12, 2024

Summary

What's changed?

  • Remove the .encode("utf-8") when creating a body from a base64 response

Why do we need this?

  • There is a bug when decoding base64, the binary body was encoded in utf-8 which of course was failing with true binary data
  • While this code was unit tested, unfortunately, it was tested with a dummy utf-8 string turned into base64, which of course did not trigger the bug as it was a valid utf-8

How have you tested it?

  • Fixed unit test to use a non-utf8 binary output
  • Tested locally by returning an image ✅

Checklist

  • I have reviewed this myself
  • There is a unit test covering every change in this PR
  • I have updated the relevant documentation

Details

@cyclimse cyclimse self-assigned this Jul 12, 2024
@cyclimse cyclimse requested review from Bemilie and norbjd July 12, 2024 21:04
@norbjd norbjd merged commit 493390d into main Jul 15, 2024
6 checks passed
@norbjd norbjd deleted the fix/issue-with-base64-encoded-data branch July 15, 2024 12:05
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.

3 participants