mirror of
https://github.com/gogs/gogs.git
synced 2025-05-29 18:53:42 +00:00
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>
This commit is contained in:
parent
306ba917ea
commit
9085c3b73d
@ -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]
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user