Content-Disposition HTTP header in mediaapi's responses added (#685)

This should fix #628
I also Noticed that GET /_matrix/media/r0/download/{serverName}/{mediaId}/{fileName} is not yet implemented, but it should work for both.

Signed-off-by: Kouamé Behouba Manassé behouba@gmail.com
main
Behouba Manassé 2019-07-08 16:06:17 +03:00 committed by Andrew Morgan
parent da0dd06475
commit 69f8d5a77e
1 changed files with 4 additions and 0 deletions

View File

@ -305,6 +305,10 @@ func (r *downloadRequest) respondFromLocalFile(
}).Info("Responding with file")
responseFile = file
responseMetadata = r.MediaMetadata
if len(responseMetadata.UploadName) > 0 {
w.Header().Set("Content-Disposition", fmt.Sprintf(`inline; filename*=utf-8"%s"`, responseMetadata.UploadName))
}
}
w.Header().Set("Content-Type", string(responseMetadata.ContentType))