Skip to content

Commit 2e988d5

Browse files
committed
Fix fetch body handling for FileUpload objects in uploadToStorage
Restore the original conditional logic to properly handle both File and FileUpload types. - File objects extend Blob and can be passed directly to fetch - FileUpload objects need .stream() called to get a ReadableStream for the fetch body This fixes the misleading type signature where File | FileUpload is accepted but only File was being handled correctly.
1 parent 54e0fd0 commit 2e988d5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

app/utils/storage.server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ async function uploadToStorage(file: File | FileUpload, key: string) {
1414
const uploadResponse = await fetch(url, {
1515
method: 'PUT',
1616
headers,
17-
body: file,
17+
body: file instanceof File ? file : file.stream(),
1818
})
1919

2020
if (!uploadResponse.ok) {

0 commit comments

Comments
 (0)