Skip to content

Commit 9af6292

Browse files
committed
Fix error when syncing comments when PR is not synced
1 parent 1c8b8ef commit 9af6292

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

services/migrations/gitea_uploader.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,10 @@ func (g *GiteaLocalUploader) prepareComments(comments ...*base.Comment) ([]*issu
476476
var issue *issues_model.Issue
477477
issue, ok := g.issues[comment.IssueIndex]
478478
if !ok {
479-
return nil, fmt.Errorf("comment references non existent IssueIndex %d", comment.IssueIndex)
479+
// ignore comments for non existent issues
480+
// It can happen when a comment belongs to a pull request, but the pull request is not imported
481+
log.Warn("Ignoring comment for non existent issue %d", comment.IssueIndex)
482+
continue
480483
}
481484

482485
if comment.Created.IsZero() {

0 commit comments

Comments
 (0)