fix: generate checksums on API asset upload #175
@@ -18,6 +18,7 @@ import (
|
||||
"git.mokoconsulting.tech/MokoConsulting/MokoGitea/services/context"
|
||||
"git.mokoconsulting.tech/MokoConsulting/MokoGitea/services/context/upload"
|
||||
"git.mokoconsulting.tech/MokoConsulting/MokoGitea/services/convert"
|
||||
release_service "git.mokoconsulting.tech/MokoConsulting/MokoGitea/services/release"
|
||||
)
|
||||
|
||||
func checkReleaseMatchRepo(ctx *context.APIContext, releaseID int64) bool {
|
||||
@@ -263,6 +264,14 @@ func CreateReleaseAttachment(ctx *context.APIContext) {
|
||||
return
|
||||
}
|
||||
|
||||
// Regenerate checksums after new attachment
|
||||
rel, relErr := repo_model.GetReleaseByID(ctx, releaseID)
|
||||
if relErr == nil {
|
||||
if checksumErr := release_service.GenerateReleaseChecksums(ctx, rel); checksumErr != nil {
|
||||
log.Error("GenerateReleaseChecksums after upload: %v", checksumErr)
|
||||
}
|
||||
}
|
||||
|
||||
ctx.JSON(http.StatusCreated, convert.ToAPIAttachment(ctx.Repo.Repository, attach))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user