8000 fix(blob): use `ensure` option if present by johannschopplich · Pull Request #324 · nuxt-hub/core · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix(blob): use ensure option if pres 8000 ent #324

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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