fix: correct filename in content-disposition header

Signed-off-by: Alexander Onnikov <Alexander.Onnikov@xored.com>
This commit is contained in:
Alexander Onnikov 2025-05-30 10:10:11 +07:00
parent 84ddf7e7c0
commit d3adee2aca
No known key found for this signature in database
GPG Key ID: 3320C3B3324E934C

View File

@ -70,7 +70,7 @@ export async function handleBlobGet (
res.setHeader('Content-Security-Policy', "default-src 'none';")
res.setHeader(
'Content-Disposition',
filename !== undefined ? `attachment; filename*=UTF-8''${encodeURIComponent(filename)}"` : 'attachment'
filename !== undefined ? `attachment; filename*=UTF-8''${encodeURIComponent(filename)}` : 'attachment'
)
res.setHeader('Cache-Control', blob.cacheControl ?? cacheControl)
res.setHeader('Last-Modified', new Date(blob.lastModified).toUTCString())
@ -122,7 +122,10 @@ export async function handleBlobHead (
res.setHeader('Content-Length', head.size.toString())
res.setHeader('Content-Type', head.contentType ?? '')
res.setHeader('Content-Security-Policy', "default-src 'none';")
res.setHeader('Content-Disposition', filename !== undefined ? `attachment; filename="${filename}"` : 'attachment')
res.setHeader(
'Content-Disposition',
filename !== undefined ? `attachment; filename*=UTF-8''${encodeURIComponent(filename)}` : 'attachment'
)
res.setHeader('Cache-Control', head.cacheControl ?? cacheControl)
res.setHeader('Last-Modified', new Date(head.lastModified).toUTCString())
res.setHeader('ETag', wrapETag(head.etag))