summaryrefslogtreecommitdiffstats
path: root/routers/repo/commit.go
diff options
context:
space:
mode:
Diffstat (limited to 'routers/repo/commit.go')
-rw-r--r--routers/repo/commit.go10
1 files changed, 8 insertions, 2 deletions
diff --git a/routers/repo/commit.go b/routers/repo/commit.go
index 44427b8a42..09dcaf5ead 100644
--- a/routers/repo/commit.go
+++ b/routers/repo/commit.go
@@ -85,11 +85,17 @@ func Diff(ctx *middleware.Context, params martini.Params) {
return false
}
- data, err := blob.Data()
+ dataRc, err := blob.Data()
if err != nil {
return false
}
- _, isImage := base.IsImageFile(data)
+ buf := make([]byte, 1024)
+ n, _ := dataRc.Read(buf)
+ if n > 0 {
+ buf = buf[:n]
+ }
+ dataRc.Close()
+ _, isImage := base.IsImageFile(buf)
return isImage
}