mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-10 12:15:43 +01: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 {
|
switch cm.Type {
|
||||||
case issues_model.CommentTypeAssignees:
|
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 {
|
if comment.Meta["RemovedAssigneeID"] != nil {
|
||||||
cm.RemovedAssignee = true
|
cm.RemovedAssignee = true
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue