diff options
author | Unknwon <u@gogs.io> | 2016-08-31 13:59:23 -0700 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2016-08-31 13:59:23 -0700 |
commit | dadd35b63647327bed02719f6cda5d25256fa49e (patch) | |
tree | a05aa8f90afc18542b6373cdf747c39df8e67c11 /routers | |
parent | c2afdf2192b9f0287968e29160e30a45a3ff1339 (diff) | |
download | gitea-dadd35b63647327bed02719f6cda5d25256fa49e.tar.gz gitea-dadd35b63647327bed02719f6cda5d25256fa49e.zip |
#3559 fix template error
Diffstat (limited to 'routers')
-rw-r--r-- | routers/repo/editor.go | 4 | ||||
-rw-r--r-- | routers/repo/view.go | 9 |
2 files changed, 4 insertions, 9 deletions
diff --git a/routers/repo/editor.go b/routers/repo/editor.go index bf2244719c..428a25d568 100644 --- a/routers/repo/editor.go +++ b/routers/repo/editor.go @@ -64,9 +64,7 @@ func editFile(ctx *context.Context, isNewFile bool) { buf := make([]byte, 1024) n, _ := dataRc.Read(buf) - if n > 0 { - buf = buf[:n] - } + buf = buf[:n] // Only text file are editable online. if !base.IsTextFile(buf) { diff --git a/routers/repo/view.go b/routers/repo/view.go index 055785564d..c04ef1ee3f 100644 --- a/routers/repo/view.go +++ b/routers/repo/view.go @@ -64,6 +64,7 @@ func renderDirectory(ctx *context.Context, treeLink string) { } if readmeFile != nil { + ctx.Data["RawFileLink"] = "" ctx.Data["ReadmeInList"] = true ctx.Data["ReadmeExist"] = true @@ -75,9 +76,7 @@ func renderDirectory(ctx *context.Context, treeLink string) { buf := make([]byte, 1024) n, _ := dataRc.Read(buf) - if n > 0 { - buf = buf[:n] - } + buf = buf[:n] isTextFile := base.IsTextFile(buf) ctx.Data["FileIsText"] = isTextFile @@ -134,9 +133,7 @@ func renderFile(ctx *context.Context, entry *git.TreeEntry, treeLink, rawLink st buf := make([]byte, 1024) n, _ := dataRc.Read(buf) - if n > 0 { - buf = buf[:n] - } + buf = buf[:n] isTextFile := base.IsTextFile(buf) ctx.Data["IsTextFile"] = isTextFile |