allow audio upload

This commit is contained in:
2026-06-03 12:30:11 +03:30
parent 23c5d9c667
commit afb8f9436c
2 changed files with 709 additions and 9 deletions
+701
View File
File diff suppressed because one or more lines are too long
@@ -24,14 +24,6 @@ export class UploaderService {
'video/avi',
'video/mov',
'video/mkv',
'audio/mp3',
'audio/wav',
'audio/ogg',
'audio/webm',
'audio/m4a',
'audio/aac',
'audio/flac',
'audio/m4a',
'image/jpeg',
'image/png',
'image/gif',
@@ -107,12 +99,19 @@ export class UploaderService {
UploaderMessage.UPLOAD_FILE_TOO_LARGE.replace('[MAX_FILE_SIZE]', this.maxFileSize.toString()),
);
if (!this.allowedMimeTypes.includes(file.mimetype))
if (!this.isAllowedMimeType(file.mimetype))
throw new BadRequestException(
UploaderMessage.UPLOAD_FILE_TYPE_NOT_SUPPORTED.replace('[MIME_TYPES]', file.mimetype),
);
}
private isAllowedMimeType(mimetype: string): boolean {
if (mimetype.startsWith('audio/')) {
return true;
}
return this.allowedMimeTypes.includes(mimetype);
}
/**
* Determine file type based on mimetype
*/