fix: zero byte image uploads (#29426)

This commit is contained in:
Ryan Rockey
2026-07-16 13:00:07 +02:00
committed by GitHub
parent c50a807bc1
commit 80cdfebbc7
@@ -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,