From 242f10952d62d4736bc0873b718dce2f93ca365a Mon Sep 17 00:00:00 2001 From: Alex Date: Mon, 19 Sep 2022 10:48:44 -0500 Subject: [PATCH] fix(server): query only image (#724) --- server/apps/immich/src/api-v1/asset/asset-repository.ts | 2 -- server/apps/immich/src/config/asset-upload.config.ts | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/server/apps/immich/src/api-v1/asset/asset-repository.ts b/server/apps/immich/src/api-v1/asset/asset-repository.ts index ccdcf16a99..3c88633231 100644 --- a/server/apps/immich/src/api-v1/asset/asset-repository.ts +++ b/server/apps/immich/src/api-v1/asset/asset-repository.ts @@ -171,7 +171,6 @@ export class AssetRepository implements IAssetRepository { .createQueryBuilder('asset') .where('asset.userId = :userId', { userId: userId }) .andWhere('asset.resizePath is not NULL') - .andWhere('asset.type = :type', { type: AssetType.IMAGE }) .leftJoinAndSelect('asset.exifInfo', 'exifInfo') .orderBy('asset.createdAt', 'DESC'); @@ -226,7 +225,6 @@ export class AssetRepository implements IAssetRepository { where: { userId: userId, deviceId: deviceId, - type: AssetType.IMAGE, }, select: ['deviceAssetId'], }); diff --git a/server/apps/immich/src/config/asset-upload.config.ts b/server/apps/immich/src/config/asset-upload.config.ts index 55769e8a8e..648f83cc33 100644 --- a/server/apps/immich/src/config/asset-upload.config.ts +++ b/server/apps/immich/src/config/asset-upload.config.ts @@ -39,8 +39,8 @@ export const assetUploadOption: MulterOptions = { filename: (req: Request, file: Express.Multer.File, cb: any) => { const fileNameUUID = randomUUID(); const fileName = `${fileNameUUID}${req.body['fileExtension'].toLowerCase()}`; - - cb(null, sanitize(fileName)); + const sanitizedFileName = sanitize(fileName); + cb(null, sanitizedFileName); }, }), };