Skip to content

Commit 2079b6a

Browse files
committed
fix(blob): sanitize pathname to avoid doubleslash
1 parent 4eb1965 commit 2079b6a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/runtime/server/utils/blob.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ export function hubBlob(): HubBlob {
335335
}
336336

337337
if (prefix) {
338-
pathname = joinURL(prefix, pathname)
338+
pathname = joinURL(prefix, pathname).replace(/\/+/g, '/').replace(/^\/+/, '')
339339
}
340340

341341
const httpMetadata: Record<string, string> = { contentType }
@@ -375,7 +375,7 @@ export function hubBlob(): HubBlob {
375375
pathname = joinURL(dir === '.' ? '' : dir, `${slugify(filename)}${ext}`)
376376
}
377377
if (prefix) {
378-
pathname = joinURL(prefix, pathname)
378+
pathname = joinURL(prefix, pathname).replace(/\/+/g, '/').replace(/^\/+/, '')
379379
}
380380

381381
const httpMetadata: Record<string, string> = { contentType }

0 commit comments

Comments
 (0)