summaryrefslogtreecommitdiffstats
path: root/routers/repo/repo.go
diff options
context:
space:
mode:
authorslene <vslene@gmail.com>2014-05-25 23:44:45 +0800
committerslene <vslene@gmail.com>2014-05-28 14:01:41 +0800
commite323604d781268a39febced13a2fb6caae2d126c (patch)
treea58ea9992baaabb31be3a8b2612eeb76c9ab4370 /routers/repo/repo.go
parent4ee6bc4fcac47edeea1f1e9fd5fbfd3ef595bbca (diff)
downloadgitea-e323604d781268a39febced13a2fb6caae2d126c.tar.gz
gitea-e323604d781268a39febced13a2fb6caae2d126c.zip
display large file
Diffstat (limited to 'routers/repo/repo.go')
-rw-r--r--routers/repo/repo.go9
1 files changed, 4 insertions, 5 deletions
diff --git a/routers/repo/repo.go b/routers/repo/repo.go
index 3f46332c1c..5a200bae61 100644
--- a/routers/repo/repo.go
+++ b/routers/repo/repo.go
@@ -176,9 +176,10 @@ func Single(ctx *middleware.Context, params martini.Params) {
_, isImageFile := base.IsImageFile(buf)
ctx.Data["FileIsText"] = isTextFile
- if isImageFile {
+ switch {
+ case isImageFile:
ctx.Data["IsImageFile"] = true
- } else {
+ case isTextFile:
d, _ := ioutil.ReadAll(dataRc)
buf = append(buf, d...)
readmeExist := base.IsMarkdownFile(blob.Name()) || base.IsReadmeFile(blob.Name())
@@ -186,9 +187,7 @@ func Single(ctx *middleware.Context, params martini.Params) {
if readmeExist {
ctx.Data["FileContent"] = string(base.RenderMarkdown(buf, ""))
} else {
- if isTextFile {
- ctx.Data["FileContent"] = string(buf)
- }
+ ctx.Data["FileContent"] = string(buf)
}
}
}