likyh commented on code in PR #2212:
URL: https://github.com/apache/incubator-devlake/pull/2212#discussion_r898856830
##########
plugins/gitlab/impl/impl.go:
##########
@@ -82,8 +85,23 @@ func (plugin Gitlab) PrepareTaskData(taskCtx
core.TaskContext, options map[strin
if err != nil {
return nil, err
}
-
+ if op.ConnectionId == 0 {
+ return nil, fmt.Errorf("connectionId is invalid")
+ }
+ connection := &models.GitlabConnection{}
+ connectionHelper := helper.NewConnectionHelper(
+ taskCtx,
+ nil,
+ )
+ if err != nil {
+ return nil, err
+ }
+ err = connectionHelper.FirstById(connection, op.ConnectionId)
+ if err != nil {
+ return nil, err
+ }
apiClient, err := tasks.NewGitlabApiClient(taskCtx)
Review Comment:
it's in NewGitlabApiClient. Or you can fix it in next pr.
##########
plugins/gitlab/impl/impl.go:
##########
@@ -82,8 +85,23 @@ func (plugin Gitlab) PrepareTaskData(taskCtx
core.TaskContext, options map[strin
if err != nil {
return nil, err
}
-
+ if op.ConnectionId == 0 {
+ return nil, fmt.Errorf("connectionId is invalid")
+ }
+ connection := &models.GitlabConnection{}
+ connectionHelper := helper.NewConnectionHelper(
+ taskCtx,
+ nil,
+ )
+ if err != nil {
+ return nil, err
+ }
+ err = connectionHelper.FirstById(connection, op.ConnectionId)
+ if err != nil {
+ return nil, err
+ }
apiClient, err := tasks.NewGitlabApiClient(taskCtx)
Review Comment:
it's in NewGitlabApiClient. Or you can fix it in next pr.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]