Repository navigation
FIX Upload edited images under their own file name in OpenAIImageTarget - #3496
Open
Shivam Sharma (ShivamSharma43) wants to merge 1 commit into
Open
Shivam Sharma (ShivamSharma43) wants to merge 1 commit into
Shivam Sharma (ShivamSharma43) wants to merge 1 commit into
Conversation
The edit request used get_data_filename_async() as the multipart file name. That generates a new local storage path with a random name and a .png extension, so the image's real name was never sent, JPEG and WebP inputs were named .png, and the local results directory was sent to the provider. Use Path(image_path).name, as OpenAIVideoTarget already does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
Description
Fixes #3494.
OpenAIImageTarget._send_edit_request_asyncusedget_data_filename_async()as the multipart file name for each image. That method generates a new storage path for saving data: a full path under the results directory with a random UUID and a.pngextension. So the image's own name was never sent, JPEG and WebP inputs were named.png, and every edit request sent the provider the local results directory, which can include the user's name.Changes:
OpenAIImageTargetuploads each image asPath(image_path).name, which is whatOpenAIVideoTargetalready does for its image upload.The bytes and the MIME type are unchanged; they already came from the image itself.
Tests and Documentation
tests/unit/prompt_target/target/test_image_target.py: an edit request with one JPEG, and one with a PNG and a JPEG, sends each image as(file name, bytes, MIME type)with its own file name.mainboth cases fail (the generated<uuid>.pngpath is sent); with this change they pass.pytest tests/unit/prompt_target: 1827 passed, 247 skipped.ruff check,ruff formatandty checkpass on the changed files.🤖 Generated with Claude Code