Skip to content

Commit

Permalink
fix(blob): use ensure option if present (#324)
Browse files Browse the repository at this point in the history
Co-authored-by: Sébastien Chopin <[email protected]>
  • Loading branch information
johannschopplich and atinux authored Oct 15, 2024
1 parent 6502032 commit 47753b4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/runtime/blob/server/utils/blob.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { R2Bucket, ReadableStream, R2MultipartUpload } from '@cloudflare/workers-types/experimental'
import type { R2Bucket, ReadableStream, R2MultipartUpload, R2Object } from '@cloudflare/workers-types/experimental'
import { ofetch } from 'ofetch'
import mime from 'mime'
import { z } from 'zod'
Expand Down Expand Up @@ -290,7 +290,7 @@ export function hubBlob(): HubBlob {
multiple: true
})
const form = await readFormData(event)
const files = form.getAll(options.formKey) as File[]
const files = form.getAll(options.formKey!) as File[]
if (!files) {
throw createError({ statusCode: 400, message: 'Missing files' })
}
Expand All @@ -301,7 +301,7 @@ export function hubBlob(): HubBlob {
const objects: BlobObject[] = []
try {
// Ensure the files meet the requirements
if (options.maxSize || options.types?.length) {
if (options.ensure) {
for (const file of files) {
ensureBlob(file, options.ensure)
}
Expand Down

0 comments on commit 47753b4

Please sign in to comment.