mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-15 10:53:09 -06:00
Fix Content-Disposition HTTP header in mediaapi's responses matrix-org/dendrite#628
This commit is contained in:
parent
3465f6727b
commit
93c2a20926
|
|
@ -316,6 +316,10 @@ func (r *downloadRequest) respondFromLocalFile(
|
||||||
" object-src 'self';"
|
" object-src 'self';"
|
||||||
w.Header().Set("Content-Security-Policy", contentSecurityPolicy)
|
w.Header().Set("Content-Security-Policy", contentSecurityPolicy)
|
||||||
|
|
||||||
|
if len(responseMetadata.UploadName) > 0 && !r.IsThumbnailRequest {
|
||||||
|
w.Header().Set("Content-Disposition", fmt.Sprintf(`inline; filename*=utf-8"%s"`, responseMetadata.UploadName))
|
||||||
|
}
|
||||||
|
|
||||||
if _, err := io.Copy(w, responseFile); err != nil {
|
if _, err := io.Copy(w, responseFile); err != nil {
|
||||||
return nil, errors.Wrap(err, "failed to copy from cache")
|
return nil, errors.Wrap(err, "failed to copy from cache")
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue