File tree Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -237,7 +237,9 @@ export class Storage {
237
237
)
238
238
}
239
239
240
- if ( ! type . match ( / ^ [ a - z A - Z 0 - 9 \- \+ ] + \/ ( [ a - z A - Z 0 - 9 \- \+ \. ] + $ ) | \* $ / ) ) {
240
+ if (
241
+ ! type . match ( / ^ ( [ a - z A - Z 0 - 9 \- + . ] + ) \/ ( [ a - z A - Z 0 - 9 \- + . ] + ) ( ; \s * c h a r s e t = [ a - z A - Z 0 - 9 \- ] + ) ? $ | \* $ / )
242
+ ) {
241
243
throw new StorageBackendError (
242
244
'invalid_mime_type' ,
243
245
422 ,
Original file line number Diff line number Diff line change @@ -226,11 +226,13 @@ export class Uploader {
226
226
continue
227
227
}
228
228
229
- if ( allowedMime [ 0 ] === type && allowedMime [ 1 ] === '*' ) {
229
+ const [ allowedType , allowedExtension ] = allowedMime
230
+
231
+ if ( allowedType === type && allowedExtension === '*' ) {
230
232
return true
231
233
}
232
234
233
- if ( allowedMime [ 0 ] === type && allowedMime [ 1 ] === ext ) {
235
+ if ( allowedType === type && allowedExtension === ext ) {
234
236
return true
235
237
}
236
238
}
@@ -267,7 +269,8 @@ export class Uploader {
267
269
const cacheTime = formData . fields . cacheControl ?. value
268
270
269
271
body = formData . file
270
- mimeType = formData . mimetype
272
+ /* @ts -expect-error: https://github.com/aws/aws-sdk-js-v3/issues/2085 */
273
+ mimeType = formData . fields . contentType ?. value || formData . mimetype
271
274
cacheControl = cacheTime ? `max-age=${ cacheTime } ` : 'no-cache'
272
275
isTruncated = ( ) => formData . file . truncated
273
276
} catch ( e ) {
You can’t perform that action at this time.
0 commit comments