Skip to content

fix(server): Allow saving empty description tag to sidecar #19178

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

dahool
Copy link
Collaborator

@dahool dahool commented Jun 14, 2025

Description

Currently, clearing an embedded Description or ImageDescription tag is not possible when the file contains an embedded entry. ExifTool treats an empty string as a directive to delete the tag, meaning it will fall back to reading the embedded tag if the sidecar's tag is not defined. This change enables writing an empty string to the sidecar for these tags, thereby overriding the embedded description and effectively clearing it from the asset's displayed metadata.

Fixes #15990
Fixes #19168

Added new e2e test. (requires updated asset : immich-app/test-assets#18 )

sidecar with empty tags

<?xpacket begin='' id='W5M0MpCehiHzreSzNTczkc9d'?>
<x:xmpmeta xmlns:x='adobe:ns:meta/' x:xmptk='Image::ExifTool 13.00'>
<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'>

 <rdf:Description rdf:about=''
  xmlns:dc='http://purl.org/dc/elements/1.1/'>
  <dc:description>
   <rdf:Alt>
    <rdf:li xml:lang='x-default'/>
   </rdf:Alt>
  </dc:description>
 </rdf:Description>

 <rdf:Description rdf:about=''
  xmlns:tiff='http://ns.adobe.com/tiff/1.0/'>
  <tiff:ImageDescription>
   <rdf:Alt>
    <rdf:li xml:lang='x-default'/>
   </rdf:Alt>
  </tiff:ImageDescription>
 </rdf:Description>
</rdf:RDF>
</x:xmpmeta>
<?xpacket end='w'?>

Checklist:

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation if applicable
  • I have no unrelated changes in the PR.
  • I have confirmed that any new dependencies are strictly necessary.
  • I have written tests for new code (if applicable)
  • I have followed naming conventions/patterns in the surrounding code
  • All code in src/services/ uses repositories implementations for database calls, filesystem operations, etc.
  • All code in src/repositories/ is pretty basic/simple and does not have any immich specific logic (that belongs in src/services/)

@dahool dahool requested a review from danieldietzler as a code owner June 14, 2025 19:28
@dahool dahool changed the title Allow saving empty description tag to sidecar (fix: server) Allow saving empty description tag to sidecar Jun 14, 2025
@dahool dahool changed the title (fix: server) Allow saving empty description tag to sidecar fix(server) Allow saving empty description tag to sidecar Jun 14, 2025
@dahool dahool changed the title fix(server) Allow saving empty description tag to sidecar fix(server): Allow saving empty description tag to sidecar Jun 14, 2025
@mmomjian
Copy link
Collaborator

mmomjian commented Jun 14, 2025

How will this handle existing assets with an empty description? Will it write an empty Description field for every asset when it refreshes metadata? I am not sure if that is desired. Currently sidecar files are generated when metadata is changed/set, this would result in every single file getting a sidecar (if I am interpreting the patch correctly).

It seems like we should only set this special empty tag if the underlying asset has a description that is manually deleted.

On second read I guess this is only triggering when a XMP would be written anyway, so that probably won't be an issue.

@dahool
Copy link
Collaborator Author

dahool commented Jun 14, 2025

How will this handle existing assets with an empty description? Will it write an empty Description field for every asset when it refreshes metadata? I am not sure if that is desired. Currently sidecar files are generated when metadata is changed/set, this would result in every single file getting a sidecar (if I am interpreting the patch correctly).

This process does not affect existing asset metadata unless a specific update operation is performed. It exclusively writes empty Description tags to the sidecar file when the tag is intentionally set to an empty string during metadata modification.

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.

Can't set image description to blank Photo description bugs
2 participants