summaryrefslogtreecommitdiffstats
path: root/routers/repo/download.go
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2020-08-13 18:18:18 +0100
committerGitHub <noreply@github.com>2020-08-13 18:18:18 +0100
commit2ef318e6f1d0c674e894d2d1f25ca79498663466 (patch)
tree4914d7c95e814af2ffdc8ea7101b6f1b86e03ae4 /routers/repo/download.go
parente266ba30cca17bdb5c50fd0cd30d2e429e58ac26 (diff)
downloadgitea-2ef318e6f1d0c674e894d2d1f25ca79498663466.tar.gz
gitea-2ef318e6f1d0c674e894d2d1f25ca79498663466.zip
Add Access-Control-Expose-Headers (#12446)
Fix #12424 Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: silverwind <me@silverwind.io>
Diffstat (limited to 'routers/repo/download.go')
-rw-r--r--routers/repo/download.go2
1 files changed, 2 insertions, 0 deletions
diff --git a/routers/repo/download.go b/routers/repo/download.go
index 7ef0574b1d..5ae9475ae7 100644
--- a/routers/repo/download.go
+++ b/routers/repo/download.go
@@ -42,8 +42,10 @@ func ServeData(ctx *context.Context, name string, reader io.Reader) error {
ctx.Resp.Header().Set("Content-Type", "text/plain; charset="+strings.ToLower(cs))
} else if base.IsImageFile(buf) || base.IsPDFFile(buf) {
ctx.Resp.Header().Set("Content-Disposition", fmt.Sprintf(`inline; filename="%s"`, name))
+ ctx.Resp.Header().Set("Access-Control-Expose-Headers", "Content-Disposition")
} else {
ctx.Resp.Header().Set("Content-Disposition", fmt.Sprintf(`attachment; filename="%s"`, name))
+ ctx.Resp.Header().Set("Access-Control-Expose-Headers", "Content-Disposition")
}
_, err := ctx.Resp.Write(buf)