We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent abbe492 commit 3ffe15dCopy full SHA for 3ffe15d
libraries/nestjs-libraries/src/upload/s3.storage.ts
@@ -73,7 +73,8 @@ export class S3Storage implements IUploadProvider {
73
const contentType =
74
loadImage?.headers?.get('content-type') ||
75
loadImage?.headers?.get('Content-Type');
76
- const extension = getExtension(contentType)!;
+ // Fallback to 'bin' if MIME type is unrecognized, or try to extract from URL
77
+ const extension = getExtension(contentType) || path.split('.').pop()?.split('?')[0] || 'bin';
78
const id = makeId(10);
79
const datePath = this.getDatePath();
80
const key = `${datePath}/${id}.${extension}`;
0 commit comments