diff --git a/drivers/s3/driver.go b/drivers/s3/driver.go index 18d4af18..6f25c00a 100644 --- a/drivers/s3/driver.go +++ b/drivers/s3/driver.go @@ -61,7 +61,10 @@ func (d *S3) List(ctx context.Context, dir model.Obj, args model.ListArgs) ([]mo func (d *S3) Link(ctx context.Context, file model.Obj, args model.LinkArgs) (*model.Link, error) { path := getKey(file.GetPath(), false) filename := stdpath.Base(path) - disposition := fmt.Sprintf(`attachment; filename="%s"; filename*=UTF-8''%s`, filename, url.PathEscape(filename)) + disposition := fmt.Sprintf(`attachment; filename*=UTF-8''%s`, url.PathEscape(filename)) + if d.AddFilenameToDisposition { + disposition = fmt.Sprintf(`attachment; filename="%s"; filename*=UTF-8''%s`, filename, url.PathEscape(filename)) + } input := &s3.GetObjectInput{ Bucket: &d.Bucket, Key: &path, diff --git a/drivers/s3/meta.go b/drivers/s3/meta.go index 066bce1c..18b31db9 100644 --- a/drivers/s3/meta.go +++ b/drivers/s3/meta.go @@ -7,17 +7,18 @@ import ( type Addition struct { driver.RootPath - Bucket string `json:"bucket" required:"true"` - Endpoint string `json:"endpoint" required:"true"` - Region string `json:"region"` - AccessKeyID string `json:"access_key_id" required:"true"` - SecretAccessKey string `json:"secret_access_key" required:"true"` - CustomHost string `json:"custom_host"` - SignURLExpire int `json:"sign_url_expire" type:"number" default:"4"` - Placeholder string `json:"placeholder"` - ForcePathStyle bool `json:"force_path_style"` - ListObjectVersion string `json:"list_object_version" type:"select" options:"v1,v2" default:"v1"` - RemoveBucket bool `json:"remove_bucket" help:"Remove bucket name from path when using custom host."` + Bucket string `json:"bucket" required:"true"` + Endpoint string `json:"endpoint" required:"true"` + Region string `json:"region"` + AccessKeyID string `json:"access_key_id" required:"true"` + SecretAccessKey string `json:"secret_access_key" required:"true"` + CustomHost string `json:"custom_host"` + SignURLExpire int `json:"sign_url_expire" type:"number" default:"4"` + Placeholder string `json:"placeholder"` + ForcePathStyle bool `json:"force_path_style"` + ListObjectVersion string `json:"list_object_version" type:"select" options:"v1,v2" default:"v1"` + RemoveBucket bool `json:"remove_bucket" help:"Remove bucket name from path when using custom host."` + AddFilenameToDisposition bool `json:"add_filename_to_disposition" help:"Add filename to Content-Disposition header."` } var config = driver.Config{