Skip to content

Commit

Permalink
fix(blob): handle 'pdf' type correctly in ensureBlob
Browse files Browse the repository at this point in the history
  • Loading branch information
Yizack committed Dec 12, 2024
1 parent d683995 commit fa10993
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/runtime/blob/server/utils/blob.ts
Original file line number Diff line number Diff line change
Expand Up @@ -717,7 +717,11 @@ export function ensureBlob(blob: Blob, options: BlobEnsureOptions = {}) {
}
}
const blobShortType = blob.type.split('/')[0]
if (options.types?.length && !options.types.includes(blob.type as BlobType) && !options.types.includes(blobShortType as BlobType)) {
if (options.types?.length
&& !options.types.includes(blob.type as BlobType)
&& !options.types.includes(blobShortType as BlobType)
&& !(options.types.includes('pdf' as BlobType) && blob.type === 'application/pdf')
) {
throw createError({
statusCode: 400,
message: `File type is invalid, must be: ${options.types.join(', ')}`
Expand Down

0 comments on commit fa10993

Please sign in to comment.