fix: spaces in filename will be replaced with plus sign (#3841)

Co-authored-by: XZB <i@1248.ink>
This commit is contained in:
XZB-1248
2023-03-14 12:27:42 +08:00
committed by GitHub
parent f3db23a41e
commit c4108007cd
2 changed files with 4 additions and 2 deletions

View File

@ -59,7 +59,8 @@ 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)
disposition := fmt.Sprintf(`attachment;filename="%s"`, url.QueryEscape(stdpath.Base(path)))
filename := stdpath.Base(path)
disposition := fmt.Sprintf(`attachment; filename="%s"; filename*=UTF-8''%s`, filename, url.PathEscape(filename))
input := &s3.GetObjectInput{
Bucket: &d.Bucket,
Key: &path,