summaryrefslogtreecommitdiffstats
path: root/routers/repo/view.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2021-01-23 01:49:13 +0800
committerGitHub <noreply@github.com>2021-01-22 17:49:13 +0000
commit3287ce22ef616f7334e53662c117f6bc5ddba9c3 (patch)
treecbddf7a4490351d119a65e9f321accdad56bfd56 /routers/repo/view.go
parente35d1bf5026b6e6defe2d6b2efb92cce1cb13b22 (diff)
downloadgitea-3287ce22ef616f7334e53662c117f6bc5ddba9c3.tar.gz
gitea-3287ce22ef616f7334e53662c117f6bc5ddba9c3.zip
Fix lfs preview bug (#14428)
Diffstat (limited to 'routers/repo/view.go')
-rw-r--r--routers/repo/view.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/routers/repo/view.go b/routers/repo/view.go
index fdb8d5f136..25d40c34d8 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"
@@ -435,7 +436,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
}