mirror of
https://github.com/gogs/gogs.git
synced 2026-03-03 18:51:06 +01:00
routers/repo: allow shorter SHA to download archive (#3834)
SHA length from 7-40 is now supported.
This commit is contained in:
@@ -311,14 +311,14 @@ func Download(ctx *context.Context) {
|
||||
ctx.Handle(500, "GetTagCommit", err)
|
||||
return
|
||||
}
|
||||
} else if len(refName) == 40 {
|
||||
} else if len(refName) >= 7 && len(refName) <= 40 {
|
||||
commit, err = gitRepo.GetCommit(refName)
|
||||
if err != nil {
|
||||
ctx.Handle(404, "GetCommit", nil)
|
||||
ctx.NotFound()
|
||||
return
|
||||
}
|
||||
} else {
|
||||
ctx.Handle(404, "Download", nil)
|
||||
ctx.NotFound()
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user