summaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
authorisotas38 <isotas38@example.com>2014-11-02 14:18:37 +0900
committerisotas38 <isotas38@example.com>2014-11-02 14:18:37 +0900
commit2c28ed8c05594482358cde0d59808ed64e60fb0f (patch)
treefafa9acbcb0a02d96118b1f36e20eb3d29f8c049 /routers
parent283c81316ce7081035fbd53b13acecbdddb734a6 (diff)
downloadgitea-2c28ed8c05594482358cde0d59808ed64e60fb0f.tar.gz
gitea-2c28ed8c05594482358cde0d59808ed64e60fb0f.zip
Fix #595
Diffstat (limited to 'routers')
-rw-r--r--routers/repo/repo.go5
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
}