fix(art): detect actual image format and save with correct extension#639
Closed
VintLin wants to merge 1 commit intodanielmiessler:mainfrom
Closed
fix(art): detect actual image format and save with correct extension#639VintLin wants to merge 1 commit intodanielmiessler:mainfrom
VintLin wants to merge 1 commit intodanielmiessler:mainfrom
Conversation
Collaborator
|
Thank you for this excellent fix, @VintLin! You correctly identified the core issue — the API sometimes returns a different image format than requested. We've addressed this in commit 0fc1931 with a similar approach (magic byte detection, automatic extension correction, and proper MIME type handling throughout the pipeline). Closing in favor of that fix. Your analysis of the problem was spot-on and really helped confirm the right approach! |
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.
Problem
generatemay save image bytes with a mismatched extension (e.g., JPEG bytes written to a.pngpath). This can later cause MIME-type validation failures in downstream readers/tools that trust the extension.Additionally, reference-image MIME type selection in
nano-banana-prowas extension-based only, which can also break if file suffix and bytes diverge.Changes
png,jpeg,webp,gif).flux,nano-banana,gpt-image-1,nano-banana-pro) to use smart writer.nano-banana-proreference-image MIME resolution to:remove-bg,add-bg,thumbnail) so follow-up steps apply to the real file location.Validation
generatedOutputreturned by generator functions.Fixes #633