summaryrefslogtreecommitdiffstats
path: root/routers/repo/commit.go
diff options
context:
space:
mode:
authorslene <vslene@gmail.com>2014-05-25 20:16:11 +0800
committerslene <vslene@gmail.com>2014-05-28 14:01:41 +0800
commit4ee6bc4fcac47edeea1f1e9fd5fbfd3ef595bbca (patch)
tree8867be03be123ea8c84bc92d7d388f6ac85de058 /routers/repo/commit.go
parentab13a29cb530457328cf9d3a2511c2db1d5ccaca (diff)
downloadgitea-4ee6bc4fcac47edeea1f1e9fd5fbfd3ef595bbca.tar.gz
gitea-4ee6bc4fcac47edeea1f1e9fd5fbfd3ef595bbca.zip
fix for new git api
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
}