aboutsummaryrefslogtreecommitdiff
path: root/routers/repo
diff options
context:
space:
mode:
authorJonas Östanbäck <cez81@users.noreply.github.com>2017-05-30 05:28:38 +0200
committer无闻 <u@gogs.io>2017-05-29 23:28:38 -0400
commit9085c3b73d3edb81f09478356d47e77ee89bbe46 (patch)
treebb32b6b5fdc3c7729e2ef877df939182b34c1434 /routers/repo
parent306ba917ea1bf103dd54f9a2781add39f259632f (diff)
repo/download: fix for downloading zero bytes files. (#4436)
Allocated buffer served to client and not properly truncated to number of bytes read. Signed-off-by: Jonas Östanbäck <jonas.ostanback@gmail.com>
Diffstat (limited to 'routers/repo')
-rw-r--r--routers/repo/download.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/routers/repo/download.go b/routers/repo/download.go
index a1ad3eff..f5fa1fc4 100644
--- a/routers/repo/download.go
+++ b/routers/repo/download.go
@@ -18,7 +18,7 @@ import (
func ServeData(ctx *context.Context, name string, reader io.Reader) error {
buf := make([]byte, 1024)
n, _ := reader.Read(buf)
- if n > 0 {
+ if n >= 0 {
buf = buf[:n]
}