aboutsummaryrefslogtreecommitdiffstats
path: root/routers/repo/download.go
diff options
context:
space:
mode:
Diffstat (limited to 'routers/repo/download.go')
-rw-r--r--routers/repo/download.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/routers/repo/download.go b/routers/repo/download.go
index d657d9b18c..3c3256b388 100644
--- a/routers/repo/download.go
+++ b/routers/repo/download.go
@@ -8,8 +8,9 @@ import (
"io"
"path"
+ "github.com/gogits/git-shell"
+
"github.com/gogits/gogs/modules/base"
- "github.com/gogits/gogs/modules/git"
"github.com/gogits/gogs/modules/middleware"
)
@@ -21,7 +22,7 @@ func ServeData(ctx *middleware.Context, name string, reader io.Reader) error {
}
_, isTextFile := base.IsTextFile(buf)
- if ! isTextFile {
+ if !isTextFile {
_, isImageFile := base.IsImageFile(buf)
if !isImageFile {
ctx.Resp.Header().Set("Content-Disposition", "attachment; filename="+path.Base(ctx.Repo.TreeName))
@@ -45,7 +46,7 @@ func ServeBlob(ctx *middleware.Context, blob *git.Blob) error {
func SingleDownload(ctx *middleware.Context) {
blob, err := ctx.Repo.Commit.GetBlobByPath(ctx.Repo.TreeName)
if err != nil {
- if err == git.ErrNotExist {
+ if git.IsErrNotExist(err) {
ctx.Handle(404, "GetBlobByPath", nil)
} else {
ctx.Handle(500, "GetBlobByPath", err)