mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-04 11:18:19 +00:00
Fix assignment to cm.AssigneeID
when importing comments (#22528)
This is a fix for https://github.com/go-gitea/gitea/pull/22510 The code assumed that the `AssigneeID` from the comment YAML was an `int64`, but it is actually an `int`, causing a panic. It also had no check on whether the type cast was actually valid, so badly formatted YAML could also cause a panic. Both these issues have been fixed.
This commit is contained in:
parent
9f919cf083
commit
b383652e02
1 changed files with 3 additions and 1 deletions
|
@ -468,7 +468,9 @@ func (g *GiteaLocalUploader) CreateComments(comments ...*base.Comment) error {
|
|||
|
||||
switch cm.Type {
|
||||
case issues_model.CommentTypeAssignees:
|
||||
cm.AssigneeID = comment.Meta["AssigneeID"].(int64)
|
||||
if assigneeID, ok := comment.Meta["AssigneeID"].(int); ok {
|
||||
cm.AssigneeID = int64(assigneeID)
|
||||
}
|
||||
if comment.Meta["RemovedAssigneeID"] != nil {
|
||||
cm.RemovedAssignee = true
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue