summaryrefslogtreecommitdiffstats
path: root/routers/repo/download.go
diff options
context:
space:
mode:
Diffstat (limited to 'routers/repo/download.go')
-rw-r--r--routers/repo/download.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/routers/repo/download.go b/routers/repo/download.go
index 5ae9475ae7..326f097cbc 100644
--- a/routers/repo/download.go
+++ b/routers/repo/download.go
@@ -22,7 +22,10 @@ import (
// ServeData download file from io.Reader
func ServeData(ctx *context.Context, name string, reader io.Reader) error {
buf := make([]byte, 1024)
- n, _ := reader.Read(buf)
+ n, err := reader.Read(buf)
+ if err != nil && err != io.EOF {
+ return err
+ }
if n >= 0 {
buf = buf[:n]
}
@@ -48,7 +51,7 @@ func ServeData(ctx *context.Context, name string, reader io.Reader) error {
ctx.Resp.Header().Set("Access-Control-Expose-Headers", "Content-Disposition")
}
- _, err := ctx.Resp.Write(buf)
+ _, err = ctx.Resp.Write(buf)
if err != nil {
return err
}