mirror of
https://github.com/immich-app/immich.git
synced 2025-01-07 12:26:47 +01:00
fix(server): sanitization error that crash the server (#721)
This commit is contained in:
parent
572f6d833d
commit
400167f4ef
3 changed files with 3 additions and 3 deletions
|
@ -25,7 +25,7 @@ export const assetUploadOption: MulterOptions = {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const sanitizedDeviceId = sanitize(req.body['deviceId']);
|
const sanitizedDeviceId = sanitize(String(req.body['deviceId']));
|
||||||
const originalUploadFolder = join(basePath, req.user.id, 'original', sanitizedDeviceId);
|
const originalUploadFolder = join(basePath, req.user.id, 'original', sanitizedDeviceId);
|
||||||
|
|
||||||
if (!existsSync(originalUploadFolder)) {
|
if (!existsSync(originalUploadFolder)) {
|
||||||
|
|
|
@ -38,7 +38,7 @@ export const profileImageUploadOption: MulterOptions = {
|
||||||
const userId = req.user.id;
|
const userId = req.user.id;
|
||||||
const fileName = `${userId}${extname(file.originalname)}`;
|
const fileName = `${userId}${extname(file.originalname)}`;
|
||||||
|
|
||||||
cb(null, sanitize(fileName));
|
cb(null, sanitize(String(fileName)));
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
|
|
|
@ -52,7 +52,7 @@ export class ThumbnailGeneratorProcessor {
|
||||||
const basePath = APP_UPLOAD_LOCATION;
|
const basePath = APP_UPLOAD_LOCATION;
|
||||||
|
|
||||||
const { asset } = job.data;
|
const { asset } = job.data;
|
||||||
const sanitizedDeviceId = sanitize(asset.deviceId);
|
const sanitizedDeviceId = sanitize(String(asset.deviceId));
|
||||||
|
|
||||||
const resizePath = join(basePath, asset.userId, 'thumb', sanitizedDeviceId);
|
const resizePath = join(basePath, asset.userId, 'thumb', sanitizedDeviceId);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue