mirror of
https://github.com/directus/directus.git
synced 2026-04-03 03:00:39 -04:00
Catch IPTC and XMP extraction errors (#17633)
* Catch IPTC and XMP extraction errors * Add autoPurgeCache option to uploadOne Co-authored-by: Azri Kahar <42867097+azrikahar@users.noreply.github.com> --------- Co-authored-by: Azri Kahar <42867097+azrikahar@users.noreply.github.com>
This commit is contained in:
@@ -103,7 +103,7 @@ export class FilesService extends ItemsService {
|
||||
|
||||
await sudoService.updateOne(primaryKey, payload, { emitEvents: false });
|
||||
|
||||
if (this.cache && env.CACHE_AUTO_PURGE) {
|
||||
if (this.cache && env.CACHE_AUTO_PURGE && opts?.autoPurgeCache !== false) {
|
||||
await this.cache.clear();
|
||||
}
|
||||
|
||||
@@ -187,10 +187,20 @@ export class FilesService extends ItemsService {
|
||||
}
|
||||
}
|
||||
if (sharpMetadata.iptc) {
|
||||
fullMetadata.iptc = parseIptc(sharpMetadata.iptc);
|
||||
try {
|
||||
fullMetadata.iptc = parseIptc(sharpMetadata.iptc);
|
||||
} catch (err) {
|
||||
logger.warn(`Couldn't extract IPTC Photo Metadata from file`);
|
||||
logger.warn(err);
|
||||
}
|
||||
}
|
||||
if (sharpMetadata.xmp) {
|
||||
fullMetadata.xmp = parseXmp(sharpMetadata.xmp);
|
||||
try {
|
||||
fullMetadata.xmp = parseXmp(sharpMetadata.xmp);
|
||||
} catch (err) {
|
||||
logger.warn(`Couldn't extract XMP data from file`);
|
||||
logger.warn(err);
|
||||
}
|
||||
}
|
||||
|
||||
if (fullMetadata?.iptc?.Caption && typeof fullMetadata.iptc.Caption === 'string') {
|
||||
|
||||
Reference in New Issue
Block a user