feat: add download count field and unit testing for attachment. (#1512)

* feat: add download count field and unit testing.

* fix: unit testing

* refactor: improve testing.

* fix: update comment

* add default value.

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
Bo-Yi Wu 2017-04-20 10:31:31 +08:00 committed by GitHub
parent a2d365c81f
commit fa2a513c62
4 changed files with 158 additions and 9 deletions

View file

@ -351,6 +351,11 @@ func runWeb(ctx *cli.Context) error {
}
defer fr.Close()
if err := attach.IncreaseDownloadCount(); err != nil {
ctx.Handle(500, "Update", err)
return
}
if err = repo.ServeData(ctx, attach.Name, fr); err != nil {
ctx.Handle(500, "ServeData", err)
return