|
@@ -34,7 +34,7 @@ func ServeData(c *context.Context, name string, reader io.Reader, cpt *captcha.C
|
|
|
|
|
|
}
|
|
|
if af.Info.Size() > gannex.MEGABYTE*setting.Repository.RawCaptchaMinFileSize && !cpt.VerifyReq(c.Req) &&
|
|
|
- !c.IsLogged {
|
|
|
+ !c.IsLogged && !(cpt==nil){
|
|
|
c.Data["EnableCaptcha"] = true
|
|
|
c.HTML(200, "repo/download")
|
|
|
return nil
|
|
@@ -75,12 +75,6 @@ func ServeBlob(c *context.Context, blob *git.Blob, cpt *captcha.Captcha) error {
|
|
|
|
|
|
func SingleDownload(c *context.Context, cpt *captcha.Captcha) {
|
|
|
blob, err := c.Repo.Commit.GetBlobByPath(c.Repo.TreePath)
|
|
|
- if blob.Size() > gannex.MEGABYTE*setting.Repository.RawCaptchaMinFileSize && setting.Service.EnableCaptcha &&
|
|
|
- !cpt.VerifyReq(c.Req) && !c.IsLogged {
|
|
|
- c.Data["EnableCaptcha"] = true
|
|
|
- c.HTML(200, "repo/download")
|
|
|
- return
|
|
|
- }
|
|
|
if err != nil {
|
|
|
if git.IsErrNotExist(err) {
|
|
|
c.Handle(404, "GetBlobByPath", nil)
|
|
@@ -89,7 +83,8 @@ func SingleDownload(c *context.Context, cpt *captcha.Captcha) {
|
|
|
}
|
|
|
return
|
|
|
}
|
|
|
- if err = ServeBlob(c, blob, cpt); err != nil {
|
|
|
+ // reallow direct download independent of size
|
|
|
+ if err = ServeBlob(c, blob, nil); err != nil {
|
|
|
c.Handle(500, "ServeBlob", err)
|
|
|
}
|
|
|
}
|