From 22a73b67d34f0f00de8de29896c752ac4f2396bb Mon Sep 17 00:00:00 2001 From: Alex Phillips Date: Wed, 28 Jun 2023 10:40:21 -0400 Subject: [PATCH] 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 --- server/src/immich/api-v1/asset/asset.service.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/server/src/immich/api-v1/asset/asset.service.ts b/server/src/immich/api-v1/asset/asset.service.ts index 6ce6c907b3..53335ceaf2 100644 --- a/server/src/immich/api-v1/asset/asset.service.ts +++ b/server/src/immich/api-v1/asset/asset.service.ts @@ -7,7 +7,6 @@ import { ICryptoRepository, IJobRepository, ImmichReadStream, - isSidecarFileType, isSupportedFileType, IStorageRepository, JobName, @@ -152,9 +151,8 @@ export class AssetService { } if (dto.sidecarPath) { - const sidecarType = mime.lookup(dto.sidecarPath) as string; - if (!isSidecarFileType(sidecarType)) { - throw new BadRequestException(`Unsupported sidecar file type ${assetPathType}`); + if (path.extname(dto.sidecarPath).toLowerCase() !== '.xmp') { + throw new BadRequestException(`Unsupported sidecar file type`); } }