PLT-7740 Update encoding of filename in file headers (#7552)
* Remove URL escaping of filename in file headers * Add encoding for filename
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
e60f97b4a8
Коммит
cbb18479e9
@@ -337,10 +337,12 @@ func writeFileResponse(filename string, contentType string, bytes []byte, forceD
|
||||
toDownload = !isMediaType
|
||||
}
|
||||
|
||||
filename = url.PathEscape(filename)
|
||||
|
||||
if toDownload {
|
||||
w.Header().Set("Content-Disposition", "attachment;filename=\""+filename+"\"; filename*=UTF-8''"+url.QueryEscape(filename))
|
||||
w.Header().Set("Content-Disposition", "attachment;filename=\""+filename+"\"; filename*=UTF-8''"+filename)
|
||||
} else {
|
||||
w.Header().Set("Content-Disposition", "inline;filename=\""+filename+"\"; filename*=UTF-8''"+url.QueryEscape(filename))
|
||||
w.Header().Set("Content-Disposition", "inline;filename=\""+filename+"\"; filename*=UTF-8''"+filename)
|
||||
}
|
||||
|
||||
// prevent file links from being embedded in iframes
|
||||
|
||||
Ссылка в новой задаче
Block a user