Skip to content

Commit ca004f1

Browse files
committed
chore(filer): url quote content disposition
1 parent 8c964e1 commit ca004f1

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

volumes/filer.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,12 @@ func PostFile(c *drycc.Client, appID, volumeID, volumePath, name string, size in
4949
}
5050
r.ContentLength = size
5151
r.Header.Add("Content-Type", "filer/octet-stream")
52-
r.Header.Add("Content-Disposition", fmt.Sprintf(`attachment; filename="%s"; filepath="%s"`, name, volumePath))
52+
disposition := fmt.Sprintf(
53+
`attachment;filename*=utf-8''%s;filepath*=utf-8''%s`,
54+
url.QueryEscape(name),
55+
url.QueryEscape(volumePath),
56+
)
57+
r.Header.Add("Content-Disposition", disposition)
5358
return c.Do(r)
5459
}
5560

0 commit comments

Comments
 (0)