diff options
author | 无闻 <joe2010xtmf@163.com> | 2014-11-02 10:57:04 -0500 |
---|---|---|
committer | 无闻 <joe2010xtmf@163.com> | 2014-11-02 10:57:04 -0500 |
commit | 7e2ea7639e9cc3f8673fe127fac47c074d4dd29f (patch) | |
tree | e5768e405824819f6f001771e4fccef85090e9fc | |
parent | 5b290013a9cdf00c9b93478f3f81899055667cc9 (diff) | |
parent | 2c28ed8c05594482358cde0d59808ed64e60fb0f (diff) | |
download | gitea-7e2ea7639e9cc3f8673fe127fac47c074d4dd29f.tar.gz gitea-7e2ea7639e9cc3f8673fe127fac47c074d4dd29f.zip |
Merge pull request #596 from isotas38/dev
Fix #595
-rw-r--r-- | routers/repo/repo.go | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/routers/repo/repo.go b/routers/repo/repo.go index c8ebf23626..c6e8b504a9 100644 --- a/routers/repo/repo.go +++ b/routers/repo/repo.go @@ -263,15 +263,18 @@ func Download(ctx *middleware.Context) { refName string ext string archivePath string + archiveType git.ArchiveType ) switch { case strings.HasSuffix(uri, ".zip"): ext = ".zip" archivePath = path.Join(ctx.Repo.GitRepo.Path, "archives/zip") + archiveType = git.ZIP case strings.HasSuffix(uri, ".tar.gz"): ext = ".tar.gz" archivePath = path.Join(ctx.Repo.GitRepo.Path, "archives/targz") + archiveType = git.TARGZ default: ctx.Error(404) return @@ -316,7 +319,7 @@ func Download(ctx *middleware.Context) { archivePath = path.Join(archivePath, base.ShortSha(commit.Id.String())+ext) if !com.IsFile(archivePath) { - if err := commit.CreateArchive(archivePath, git.ZIP); err != nil { + if err := commit.CreateArchive(archivePath, archiveType); err != nil { ctx.Handle(500, "Download -> CreateArchive "+archivePath, err) return } |