fix: base64-encode binary files in /file/content endpoint#2934
Closed
shuv1337 wants to merge 1 commit into
Closed
Conversation
Binary files were being corrupted when returned as JSON strings because the server converted binary data to UTF-8, replacing invalid UTF-8 bytes with replacement characters (�). This made images and other binary files unreadable in the web interface. Changes: - Add 'encoding' field to File.Content schema (utf8 | base64) - Implement isBinaryFile() to detect binary files by extension and null bytes - Base64-encode binary files before JSON serialization - Return encoding type in API response for proper client-side decoding This eliminates the need for client-side filesystem workarounds and properly supports all binary file types (images, PDFs, executables, etc.)
rekram1-node
reviewed
Oct 2, 2025
Collaborator
|
taking a look now |
Collaborator
|
only thing that's a little weird is returning images as base64... I kinda wish response was diffed off mime type and it was a union |
Contributor
Author
Collaborator
|
Hm ill take a look too, worst case I will make some edits to this |
Contributor
Author
|
Sounds good! I'm definitely not picky about how it's implemented. If I can get usable images back from the API, I'll be happy! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Binary files were being corrupted when returned as JSON strings because the server converted binary data to UTF-8, replacing invalid UTF-8 bytes with replacement characters (�). This made images and other binary files unreadable in the web interface.
Changes:
This eliminates the need for client-side filesystem workarounds and properly supports all binary file types (images, PDFs, executables, etc.)