Skip to content

Commit 47753b4

Browse files
fix(blob): use ensure option if present (#324)
Co-authored-by: Sébastien Chopin <seb@nuxt.com>
1 parent 6502032 commit 47753b4

File tree

1 file changed

+3
-3
lines changed
  • src/runtime/blob/server/utils

1 file changed

+3
-3
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { R2Bucket, ReadableStream, R2MultipartUpload } from '@cloudflare/workers-types/experimental'
1+
import type { R2Bucket, ReadableStream, R2MultipartUpload, R2Object } from '@cloudflare/workers-types/experimental'
22
import { ofetch } from 'ofetch'
33
import mime from 'mime'
44
import { z } from 'zod'
@@ -290,7 +290,7 @@ export function hubBlob(): HubBlob {
290290
multiple: true
291291
})
292292
const form = await readFormData(event)
293-
const files = form.getAll(options.formKey) as File[]
293+
const files = form.getAll(options.formKey!) as File[]
294294
if (!files) {
295295
throw createError({ statusCode: 400, message: 'Missing files' })
296296
}
@@ -301,7 +301,7 @@ export function hubBlob(): HubBlob {
301301
const objects: BlobObject[] = []
302302
try {
303303
// Ensure the files meet the requirements
304-
if (options.maxSize || options.types?.length) {
304+
if (options.ensure) {
305305
for (const file of files) {
306306
ensureBlob(file, options.ensure)
307307
}

0 commit comments

Comments
 (0)