mirror of
https://github.com/immich-app/immich
synced 2026-08-29 13:15:45 +00:00
fix: writing empty exif tags (#27025)
This commit is contained in:
parent
f2445ecab1
commit
79f978ddeb
3 changed files with 81 additions and 2 deletions
|
|
@ -119,8 +119,12 @@ export class MetadataRepository {
|
|||
}
|
||||
|
||||
async writeTags(path: string, tags: Partial<Tags>): Promise<void> {
|
||||
// If exiftool assigns a field with ^= instead of =, empty values will be written too.
|
||||
// Since exiftool-vendored doesn't support an option for this, we append the ^ to the name of the tag instead.
|
||||
// https://exiftool.org/exiftool_pod.html#:~:text=is%20used%20to%20write%20an%20empty%20string
|
||||
const tagsToWrite = Object.fromEntries(Object.entries(tags).map(([key, value]) => [`${key}^`, value]));
|
||||
try {
|
||||
await this.exiftool.write(path, tags);
|
||||
await this.exiftool.write(path, tagsToWrite);
|
||||
} catch (error) {
|
||||
this.logger.warn(`Error writing exif data (${path}): ${error}`);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -467,7 +467,7 @@ export class MetadataService extends BaseService {
|
|||
GPSLatitude: latitude,
|
||||
GPSLongitude: longitude,
|
||||
Rating: rating,
|
||||
TagsList: tags?.length ? tags : undefined,
|
||||
TagsList: tags,
|
||||
},
|
||||
_.isUndefined,
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue