diff options
author | Jonas Ö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 |
commit | 9085c3b73d3edb81f09478356d47e77ee89bbe46 (patch) | |
tree | bb32b6b5fdc3c7729e2ef877df939182b34c1434 /routers/repo | |
parent | 306ba917ea1bf103dd54f9a2781add39f259632f (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.go | 2 |
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] } |