NestJS - Pipes
Given this FileValidationPipe code snippet, what happens if a user uploads a file with an unsupported extension?
class FileValidationPipe implements PipeTransform {
transform(file) {
const allowed = ['jpg', 'png'];
const ext = file.originalname.split('.').pop();
if (!allowed.includes(ext)) {
throw new BadRequestException('Invalid file type');
}
return file;
}
}