aboutsummaryrefslogtreecommitdiff
path: root/mediaapi/routing/download.go
diff options
context:
space:
mode:
authorBehouba Manassé <behouba@gmail.com>2019-07-08 16:06:17 +0300
committerAndrew Morgan <1342360+anoadragon453@users.noreply.github.com>2019-07-08 14:06:17 +0100
commit69f8d5a77e9392d5285fcc1c8d68659eac88c67a (patch)
tree0caa64245bc870bf73fd01d3898be0e1a7d47d4e /mediaapi/routing/download.go
parentda0dd06475a47fb28cf8381bda5f941caae6caad (diff)
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
Diffstat (limited to 'mediaapi/routing/download.go')
-rw-r--r--mediaapi/routing/download.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/mediaapi/routing/download.go b/mediaapi/routing/download.go
index 9c8f43c4..38c43636 100644
--- a/mediaapi/routing/download.go
+++ b/mediaapi/routing/download.go
@@ -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))