1
0
mirror of https://github.com/immich-app/immich.git synced 2024-12-25 10:43:13 +02:00

chore(server): check file extension for XMP instead of mimetype (#2990)

* just check file extension for XMP instead of mimetype

* use path to get extension instead of regex

* single quotes

* remove unused import

---------

Co-authored-by: Alex Tran <alex.tran1502@gmail.com>
This commit is contained in:
Alex Phillips 2023-06-28 10:40:21 -04:00 committed by GitHub
parent 792ecc6cac
commit 22a73b67d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -7,7 +7,6 @@ import {
ICryptoRepository, ICryptoRepository,
IJobRepository, IJobRepository,
ImmichReadStream, ImmichReadStream,
isSidecarFileType,
isSupportedFileType, isSupportedFileType,
IStorageRepository, IStorageRepository,
JobName, JobName,
@ -152,9 +151,8 @@ export class AssetService {
} }
if (dto.sidecarPath) { if (dto.sidecarPath) {
const sidecarType = mime.lookup(dto.sidecarPath) as string; if (path.extname(dto.sidecarPath).toLowerCase() !== '.xmp') {
if (!isSidecarFileType(sidecarType)) { throw new BadRequestException(`Unsupported sidecar file type`);
throw new BadRequestException(`Unsupported sidecar file type ${assetPathType}`);
} }
} }