1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-22 18:28:37 +00:00

move out git module and #1573 send push hook

This commit is contained in:
Unknwon
2015-12-09 20:46:05 -05:00
parent bd5dc626e8
commit 9a2e43bff2
45 changed files with 185 additions and 2002 deletions

View File

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