Skip to content

Commit b79b41c

Browse files
committed
fix: decode also in proxy
1 parent 5181cef commit b79b41c

File tree

6 files changed

+6
-5
lines changed

6 files changed

+6
-5
lines changed

src/runtime/blob/server/api/_hub/blob/[...pathname].delete.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export default eventHandler(async (event) => {
1212
pathname: z.string().min(1)
1313
}).parse)
1414

15-
await hubBlob().delete(pathname)
15+
await hubBlob().delete(decodeURIComponent(pathname))
1616

1717
return sendNoContent(event)
1818
})

src/runtime/blob/server/api/_hub/blob/[...pathname].get.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@ export default eventHandler(async (event) => {
1313
pathname: z.string().min(1)
1414
}).parse)
1515

16-
return hubBlob().serve(event, pathname)
16+
return hubBlob().serve(event, decodeURIComponent(pathname))
1717
})

src/runtime/blob/server/api/_hub/blob/[...pathname].put.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,5 @@ export default eventHandler(async (event) => {
3737
const stream = getRequestWebStream(event)!
3838
const body = await streamToArrayBuffer(stream, Number(contentLength))
3939

40-
return hubBlob().put(pathname, body, options)
40+
return hubBlob().put(decodeURIComponent(pathname), body, options)
4141
})

src/runtime/blob/server/api/_hub/blob/delete.post.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export default eventHandler(async (event) => {
1212
pathnames: z.array(z.string().min(1)).min(1)
1313
}).parse)
1414

15-
await hubBlob().delete(pathnames)
15+
await hubBlob().delete(pathnames.map(pathname => decodeURIComponent(pathname)))
1616

1717
return sendNoContent(event)
1818
})

src/runtime/blob/server/api/_hub/blob/head/[...pathname].get.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ export default eventHandler(async (event) => {
1212
pathname: z.string().min(1)
1313
}).parse)
1414

15-
return hubBlob().head(pathname)
15+
return hubBlob().head(decodeURIComponent(pathname))
1616
})

src/runtime/blob/server/api/_hub/blob/multipart/[action]/[...pathname].ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export default eventHandler(async (event) => {
1515
options.customMetadata = {}
1616
}
1717
}
18+
event.context.params!.pathname = decodeURIComponent(event.context.params!.pathname)
1819
return await hubBlob().handleMultipartUpload(event, {
1920
...options
2021
})

0 commit comments

Comments
 (0)