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
This commit is contained in:
Behouba Manassé 2019-07-08 16:06:17 +03:00 committed by Andrew Morgan
parent da0dd06475
commit 69f8d5a77e

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))