summaryrefslogtreecommitdiffstats
path: root/routers/repo/view.go
diff options
context:
space:
mode:
Diffstat (limited to 'routers/repo/view.go')
-rw-r--r--routers/repo/view.go9
1 files changed, 3 insertions, 6 deletions
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