Skip to content

Commit

Permalink
fix(blob): sanitize pathname to avoid doubleslash
Browse files Browse the repository at this point in the history
  • Loading branch information
atinux committed Jun 5, 2024
1 parent 4eb1965 commit 2079b6a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/runtime/server/utils/blob.ts
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ export function hubBlob(): HubBlob {
}

if (prefix) {
pathname = joinURL(prefix, pathname)
pathname = joinURL(prefix, pathname).replace(/\/+/g, '/').replace(/^\/+/, '')
}

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

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

0 comments on commit 2079b6a

Please sign in to comment.