Browse Source

routers/repo: allow shorter SHA to download archive (#3834)

SHA length from 7-40 is now supported.
pull/4015/merge
Unknwon 8 years ago
parent
commit
d21767dc9f
No known key found for this signature in database
GPG Key ID: 25B575AE3213B2B3
  1. 6
      routers/repo/repo.go

6
routers/repo/repo.go

@ -311,14 +311,14 @@ func Download(ctx *context.Context) {
ctx.Handle(500, "GetTagCommit", err) ctx.Handle(500, "GetTagCommit", err)
return return
} }
} else if len(refName) == 40 { } else if len(refName) >= 7 && len(refName) <= 40 {
commit, err = gitRepo.GetCommit(refName) commit, err = gitRepo.GetCommit(refName)
if err != nil { if err != nil {
ctx.Handle(404, "GetCommit", nil) ctx.NotFound()
return return
} }
} else { } else {
ctx.Handle(404, "Download", nil) ctx.NotFound()
return return
} }

Loading…
Cancel
Save