From dd827d6f2f4ab4acd637101b94e8e853f39d6b34 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Sat, 23 Jan 2021 03:55:52 +0100 Subject: [PATCH] Fix lfs preview bug (#14428) (#14433) Co-authored-by: Lunny Xiao --- routers/repo/view.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/routers/repo/view.go b/routers/repo/view.go index 2df5b30ce8..8055cba7f9 100644 --- a/routers/repo/view.go +++ b/routers/repo/view.go @@ -10,6 +10,7 @@ import ( "encoding/base64" "fmt" gotemplate "html/template" + "io" "io/ioutil" "net/url" "path" @@ -420,7 +421,9 @@ func renderFile(ctx *context.Context, entry *git.TreeEntry, treeLink, rawLink st buf = make([]byte, 1024) n, err = dataRc.Read(buf) - if err != nil { + // Error EOF don't mean there is an error, it just means we read to + // the end + if err != nil && err != io.EOF { ctx.ServerError("Data", err) return }