feat(s3): add Content-Disposition header (#365)

* add(s3): add Content-Disposition header

* Update driver.go

Signed-off-by: XZB-1248 <28593573+XZB-1248@users.noreply.github.com>

* Update driver.go

Signed-off-by: XZB-1248 <28593573+XZB-1248@users.noreply.github.com>

---------

Signed-off-by: XZB-1248 <28593573+XZB-1248@users.noreply.github.com>
Co-authored-by: XZB-1248 <i@1248.ink>
Co-authored-by: Suyunjing <69945917+Suyunmeng@users.noreply.github.com>
This commit is contained in:
XZB-1248
2025-06-27 15:29:08 +08:00
committed by GitHub
parent 7726cb14a0
commit 02031bd835
9 changed files with 63 additions and 84 deletions

View File

@ -213,8 +213,9 @@ func (b *s3Backend) GetObject(ctx context.Context, bucketName, objectName string
}
meta := map[string]string{
"Last-Modified": node.ModTime().Format(timeFormat),
"Content-Type": utils.GetMimeType(fp),
"Last-Modified": node.ModTime().Format(timeFormat),
"Content-Disposition": utils.GenerateContentDisposition(file.GetName()),
"Content-Type": utils.GetMimeType(fp),
}
if val, ok := b.meta.Load(fp); ok {
@ -328,7 +329,7 @@ func (b *s3Backend) PutObject(
func (b *s3Backend) DeleteMulti(ctx context.Context, bucketName string, objects ...string) (result gofakes3.MultiDeleteResult, rerr error) {
for _, object := range objects {
if err := b.deleteObject(ctx, bucketName, object); err != nil {
utils.Log.Errorf("serve s3", "delete object failed: %v", err)
log.Errorf("delete object failed: %v", err)
result.Error = append(result.Error, gofakes3.ErrorResult{
Code: gofakes3.ErrInternal,
Message: gofakes3.ErrInternal.Message(),