mirror of
https://github.com/saltbo/zpan.git
synced 2026-09-21 04:59:47 +08:00
fix(s3): conform to RFC 6266 for ResponseContentDisposition filename encoding
This commit is contained in:
@@ -185,7 +185,7 @@ describe('S3Service', () => {
|
||||
expect.anything(),
|
||||
expect.objectContaining({
|
||||
input: expect.objectContaining({
|
||||
ResponseContentDisposition: 'attachment; filename="my%20photo.jpg"',
|
||||
ResponseContentDisposition: 'attachment; filename="my photo.jpg"; filename*=UTF-8\'\'my%20photo.jpg',
|
||||
}),
|
||||
}),
|
||||
expect.anything(),
|
||||
|
||||
@@ -57,7 +57,7 @@ export class S3Service {
|
||||
const command = new GetObjectCommand({
|
||||
Bucket: storage.bucket,
|
||||
Key: key,
|
||||
ResponseContentDisposition: `attachment; filename="${encodeURIComponent(filename)}"`,
|
||||
ResponseContentDisposition: `attachment; filename="${filename.replace(/"/g, '\\"')}"; filename*=UTF-8''${encodeURIComponent(filename)}`,
|
||||
})
|
||||
const url = await getSignedUrl(client, command, { expiresIn })
|
||||
return this.applyCustomHost(storage, url)
|
||||
|
||||
Reference in New Issue
Block a user