[GITEA] fix POST /{username}/{reponame}/{type:issues|pulls}/{index}/content-history/soft-delete
Refs: https://forgejo.org/2023-11-release-v1-20-5-1/#api-and-web-endpoint-vulnerable-to-manually-crafted-identifiers (cherry picked from commit a11d82a42729eba02032310f7778a9197f4f8ead) (cherry picked from commitbebc244156
) (cherry picked from commit2a8cb675ca
) (cherry picked from commit56d68932ac
)
This commit is contained in:
parent
bfd03a9f30
commit
40ecd79294
1 changed files with 8 additions and 0 deletions
|
@ -198,11 +198,19 @@ func SoftDeleteContentHistory(ctx *context.Context) {
|
|||
log.Error("can not get comment for issue content history %v. err=%v", historyID, err)
|
||||
return
|
||||
}
|
||||
if comment.IssueID != issue.ID {
|
||||
ctx.NotFound("CompareRepoID", issues_model.ErrCommentNotExist{})
|
||||
return
|
||||
}
|
||||
}
|
||||
if history, err = issues_model.GetIssueContentHistoryByID(ctx, historyID); err != nil {
|
||||
log.Error("can not get issue content history %v. err=%v", historyID, err)
|
||||
return
|
||||
}
|
||||
if history.IssueID != issue.ID {
|
||||
ctx.NotFound("CompareRepoID", issues_model.ErrCommentNotExist{})
|
||||
return
|
||||
}
|
||||
|
||||
canSoftDelete := canSoftDeleteContentHistory(ctx, issue, comment, history)
|
||||
if !canSoftDelete {
|
||||
|
|
Loading…
Reference in a new issue