Skip to content

Commit c6bddbb

Browse files
authored
fix(blob): handle pdf type correctly in ensureBlob (#392)
1 parent d683995 commit c6bddbb

File tree

1 file changed

+5
-1
lines changed
  • src/runtime/blob/server/utils

1 file changed

+5
-1
lines changed

src/runtime/blob/server/utils/blob.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -717,7 +717,11 @@ export function ensureBlob(blob: Blob, options: BlobEnsureOptions = {}) {
717717
}
718718
}
719719
const blobShortType = blob.type.split('/')[0]
720-
if (options.types?.length && !options.types.includes(blob.type as BlobType) && !options.types.includes(blobShortType as BlobType)) {
720+
if (options.types?.length
721+
&& !options.types.includes(blob.type as BlobType)
722+
&& !options.types.includes(blobShortType as BlobType)
723+
&& !(options.types.includes('pdf' as BlobType) && blob.type === 'application/pdf')
724+
) {
721725
throw createError({
722726
statusCode: 400,
723727
message: `File type is invalid, must be: ${options.types.join(', ')}`

0 commit comments

Comments
 (0)