Skip to content

fix: honor empty-string metadata overrides (supersedes 9283)#9309

Merged
lstein merged 7 commits into
mainfrom
lstein/fix/supersede-9307/metadata-override-empty-string
Jun 28, 2026
Merged

fix: honor empty-string metadata overrides (supersedes 9283)#9309
lstein merged 7 commits into
mainfrom
lstein/fix/supersede-9307/metadata-override-empty-string

Conversation

@lstein

@lstein lstein commented Jun 28, 2026

Copy link
Copy Markdown
Collaborator

Summary

This PR supersedes #9283, which had python formatting issues and whose author did not respond to requests for updates. The original summary follows.

Summary

This PR makes metadata overrides in extract_metadata_from_image() honor explicitly provided empty strings instead of falling back to embedded image metadata.

Problem

The helper currently uses override or pil_image.info.get(...) for metadata, workflow, and graph overrides. That means an explicit empty-string override is treated as falsy and ignored, so the function silently falls back to the image's embedded metadata.

Changes

  • use is not None checks for metadata/workflow/graph overrides
  • add a test to ensure empty-string overrides do not fall back to image metadata

Verification

  • python -m py_compile invokeai/app/api/extract_metadata_from_image.py tests/app/test_extract_metadata_from_image.py
  • Not run: pytest is not available in this environment, so I could not execute the new test locally.

@github-actions github-actions Bot added api python PRs that change python files python-tests PRs that change python tests labels Jun 28, 2026
@JPPhoto JPPhoto self-assigned this Jun 28, 2026
@JPPhoto JPPhoto added the 6.13.5 Library Updates label Jun 28, 2026
@JPPhoto JPPhoto moved this to 6.13.5 LIBRARY UPDATES in Invoke - Community Roadmap Jun 28, 2026

@JPPhoto JPPhoto left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@lstein lstein merged commit 67e2989 into main Jun 28, 2026
17 checks passed
@lstein lstein deleted the lstein/fix/supersede-9307/metadata-override-empty-string branch June 28, 2026 14:04
dunkeroni pushed a commit to dunkeroni/InvokeAI that referenced this pull request Jun 29, 2026
…ai#9309)

* fix metadata overrides with empty string values

* chore(backend): ruff

---------

Co-authored-by: wunianze666-netizen <wunianze666@gmail.com>
Co-authored-by: Alexander Eichhorn <alex@eichhorn.dev>
Co-authored-by: Jonathan <34005131+JPPhoto@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.13.5 Library Updates api python PRs that change python files python-tests PRs that change python tests

Projects

Status: 6.13.5 LIBRARY UPDATES

Development

Successfully merging this pull request may close these issues.

4 participants