Skip to content

Commit 1da7e19

Browse files
committed
chore: try to decode pathname
1 parent 92abb27 commit 1da7e19

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

_nuxthub/server/utils/blob.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ export function useBlob () {
6666
return listed.objects.map(mapR2ObjectToBlob)
6767
},
6868
async serve (event: H3Event, pathname: string) {
69+
pathname = decodeURI(pathname)
6970
if (proxyURL) {
7071
return $fetch<ReadableStreamDefaultReader<any>>(`/api/_hub/blob/${pathname}`, {
7172
baseURL: proxyURL,
@@ -85,6 +86,7 @@ export function useBlob () {
8586
return object.body
8687
},
8788
async put (pathname: string, body: string | ReadableStream<any> | ArrayBuffer | ArrayBufferView | Blob, options: { contentType?: string, addRandomSuffix?: boolean, [key: string]: any } = { addRandomSuffix: true }) {
89+
pathname = decodeURI(pathname)
8890
if (proxyURL) {
8991
// TODO
9092
return console.warn('useBlob().put() Not implemented')
@@ -103,6 +105,7 @@ export function useBlob () {
103105
return mapR2ObjectToBlob(object)
104106
},
105107
async head (pathname: string) {
108+
pathname = decodeURI(pathname)
106109
if (proxyURL) {
107110
const { headers } = await $fetch.raw<void>(joinURL('/api/_hub/blob', pathname), {
108111
baseURL: proxyURL,
@@ -121,6 +124,7 @@ export function useBlob () {
121124
return mapR2ObjectToBlob(object)
122125
},
123126
async delete (pathname: string) {
127+
pathname = decodeURI(pathname)
124128
if (proxyURL) {
125129
await $fetch<void>(`/api/_hub/blob/${pathname}`, {
126130
baseURL: proxyURL,

0 commit comments

Comments
 (0)