fix: zero byte image uploads (#29426)

This commit is contained in:
Ryan Rockey 2026-07-16 06:00:07 -05:00 committed by GitHub
parent c50a807bc1
commit 80cdfebbc7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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,