mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
PLT-7740 Update encoding of filename in file headers (#7552)
* Remove URL escaping of filename in file headers * Add encoding for filename
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user