Skip to content

lib/dtutils/string: don't fail when version name metadata is missing - #722

Open
paulglover wants to merge 1 commit into
darktable-org:masterfrom
paulglover:version_name_optional
Open

paulglover wants to merge 1 commit into
darktable-org:masterfrom
paulglover:version_name_optional

Conversation

@paulglover

Copy link
Copy Markdown
Contributor

image.version_name is only registered on dt_lua_image_t when the version name metadata field is configured. If a user removes that field in metadata preferences, reading it raises field "version_name" not found for type dt_lua_image_t rather than returning nil, so build_substitute_list fails on every image, whatever the pattern.

The visible symptom is in contrib/rename_images: the error escapes its job loop before stop_job runs, so nothing gets renamed and the "renaming images" progress bar stays up for the rest of the session. The metadata preferences tag picker only lists exiv2 namespaces, so Xmp.darktable.version_name can't be added back from the UI.

This change reads the field through pcall and substitutes an empty string when it is absent. $(VERSION.NAME) behaves as before when the field is configured.

Tested in darktable 5.6.0 with the version name field removed: rename_images now completes.

🤖 Generated with Claude Code

image.version_name exists only when the version name metadata field is
configured. If a user removed it in metadata preferences, reading it
raises, so build_substitute_list fails on every image. Callers such as
rename_images then stop mid-job and leave their progress bar running.
The metadata preferences tag picker cannot add Xmp.darktable.version_name
back, so users have no way to recover from the UI.

Read the field through pcall and substitute an empty string when it is
absent.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@wpferguson

Copy link
Copy Markdown
Member

So the real bug is that you can't add Xmp.darktable.version_name back to metadata editor. You should raise an issue with darktable and tag @zisoft

@paulglover

paulglover commented Nov 16, 2026 via email

Copy link
Copy Markdown
Contributor Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants