diff --git a/fileserver/fileop.go b/fileserver/fileop.go index dfd6d449..cebef12a 100644 --- a/fileserver/fileop.go +++ b/fileserver/fileop.go @@ -527,7 +527,7 @@ func setCommonHeaders(rsp http.ResponseWriter, r *http.Request, operation, fileN operation == "downloadblks" { // Since the file name downloaded by safari will be garbled, we need to encode the filename. // Safari cannot parse unencoded utf8 characters. - contFileName = fmt.Sprintf("attachment;filename*=\"utf-8' '%s\"", url.PathEscape(fileName)) + contFileName = fmt.Sprintf("attachment;filename*=\"utf-8' '%s\";filename=\"%s\"", url.PathEscape(fileName), url.PathEscape(fileName)) } else { contFileName = fmt.Sprintf("inline;filename*=\"utf-8' '%s\"", url.PathEscape(fileName)) } diff --git a/server/access-file.c b/server/access-file.c index 75224437..08082c6a 100644 --- a/server/access-file.c +++ b/server/access-file.c @@ -605,7 +605,7 @@ do_file(evhtp_request_t *req, SeafRepo *repo, const char *file_id, strcmp(operation, "download-link") == 0) { /* Safari doesn't support 'utf8', 'utf-8' is compatible with most of browsers. */ snprintf(cont_filename, SEAF_PATH_MAX, - "attachment;filename*=\"utf-8\' \'%s\"", filename); + "attachment;filename*=\"utf-8\' \'%s\";filename=\"%s\"", filename, filename); } else { if (test_firefox (req)) { snprintf(cont_filename, SEAF_PATH_MAX,