summaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
authorKim Carlbäcker <kim.carlbacker@gmail.com>2016-04-27 03:48:44 +0200
committerUnknwon <u@gogs.io>2016-04-26 21:48:44 -0400
commit3df8eb60e3227b4cff671e4714d262603b82943b (patch)
tree2e4111a94375faa1ae0acf6758b9dacec26cf9b9 /routers
parent0325bec283db28ee6a464f2d1884df0c48977373 (diff)
downloadgitea-3df8eb60e3227b4cff671e4714d262603b82943b.tar.gz
gitea-3df8eb60e3227b4cff671e4714d262603b82943b.zip
PDF-Previews in file-lists now working (#3000)
Diffstat (limited to 'routers')
-rw-r--r--routers/repo/view.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/routers/repo/view.go b/routers/repo/view.go
index f4242cd52d..74c5f1ce51 100644
--- a/routers/repo/view.go
+++ b/routers/repo/view.go
@@ -70,7 +70,6 @@ func Home(ctx *context.Context) {
ctx.Handle(404, "repo.Home", nil)
return
}
-
if entry != nil && !entry.IsDir() {
blob := entry.Blob()
@@ -92,9 +91,12 @@ func Home(ctx *context.Context) {
_, isTextFile := base.IsTextFile(buf)
_, isImageFile := base.IsImageFile(buf)
+ _, isPDFFile := base.IsPDFFile(buf)
ctx.Data["IsFileText"] = isTextFile
switch {
+ case isPDFFile:
+ ctx.Data["IsPDFFile"] = true
case isImageFile:
ctx.Data["IsImageFile"] = true
case isTextFile: