mirror of
https://github.com/go-gitea/gitea.git
synced 2024-11-28 05:05:25 +08: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
@ -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 New Issue
Block a user