mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-25 11:22:16 +00:00
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:
parent
a2d365c81f
commit
fa2a513c62
4 changed files with 158 additions and 9 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue