Skip to content

High performance self-hosted photo and video management solution.

fix: zero byte image uploads (#29426)

Ryan Rockey80cdfebbc7a6
diff --git a/server/src/middleware/file-upload.interceptor.ts b/server/src/middleware/file-upload.interceptor.ts
index 1bbab36a87..cd95590019 100644
--- a/server/src/middleware/file-upload.interceptor.ts
+++ b/server/src/middleware/file-upload.interceptor.ts
@@ -1,4 +1,4 @@
-import { CallHandler, ExecutionContext, Injectable, NestInterceptor } from '@nestjs/common';
+import { BadRequestException, CallHandler, ExecutionContext, Injectable, NestInterceptor } from '@nestjs/common';
import { PATH_METADATA } from '@nestjs/common/constants';
import { Reflector } from '@nestjs/core';
import { transformException } from '@nestjs/platform-express/multer/multer/multer.utils';
@@ -129,6 +129,9 @@ export class FileUploadInterceptor implements NestInterceptor {
hash?.destroy();
return callback(error);
}
+ if (size === 0) {
+ return callback(new BadRequestException('File is empty'));
+ }
callback(null, {
path,
size,