1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-03 09:07:19 +00:00

PDF-Previews in file-lists now working (#3000)

This commit is contained in:
Kim Carlbäcker
2016-04-27 03:48:44 +02:00
committed by Unknwon
parent 0325bec283
commit 3df8eb60e3
95 changed files with 64456 additions and 1 deletions

View File

@ -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: