You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by zh...@apache.org on 2022/08/23 07:06:37 UTC
[incubator-devlake] 01/01: fix: fix Jira adding connection bug
This is an automated email from the ASF dual-hosted git repository.
zhangliang2022 pushed a commit to tag v0.12.1
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git
commit ec4320038d329d4354d74627b308a580bf87f20a
Author: zhangliang <li...@merico.dev>
AuthorDate: Tue Aug 16 23:26:42 2022 +0800
fix: fix Jira adding connection bug
---
plugins/jira/api/connection.go | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/plugins/jira/api/connection.go b/plugins/jira/api/connection.go
index d3bf634b..b7f97ed4 100644
--- a/plugins/jira/api/connection.go
+++ b/plugins/jira/api/connection.go
@@ -94,31 +94,31 @@ func TestConnection(input *core.ApiResourceInput) (*core.ApiResourceOutput, erro
return nil, fmt.Errorf("%s unexpected status code: %d", serverInfoFail, res.StatusCode)
}
- // usersSearch checking
- usersSearchFail := "You are suceess on test the serverInfo but failed to test on userSearch"
- res, err = apiClient.Get("api/3/users/search", nil, nil)
+ // verify credential
+ getStatusFail := "an error occurred while making request to `/rest/api/2/status`"
+ res, err = apiClient.Get("api/2/status", nil, nil)
if err != nil {
- return nil, fmt.Errorf("%s %s", usersSearchFail, err)
+ return nil, fmt.Errorf("%s %s", getStatusFail, err)
}
- usersSearchFail += ": [ " + res.Request.URL.String() + " ]"
+ getStatusFail += ": [ " + res.Request.URL.String() + " ]"
errMsg := ""
if res.StatusCode == http.StatusForbidden {
resErrBody := &models.JiraErrorInfo{}
err = helper.UnmarshalResponse(res, resErrBody)
if err != nil {
- return nil, fmt.Errorf("%s Unexpected status code: %d,and UnmarshalResponse error %s", usersSearchFail, res.StatusCode, err)
+ return nil, fmt.Errorf("%s Unexpected status code: %d,and UnmarshalResponse error %s", getStatusFail, res.StatusCode, err)
}
for _, em := range resErrBody.ErrorMessages {
if em == "error.no-permission" {
- return nil, fmt.Errorf("%s We get the error %s ,it might you use the right token(password) but with the wrong username.please check your password", usersSearchFail, em)
+ return nil, fmt.Errorf("%s We get the error %s ,it might you use the right token(password) but with the wrong username.please check your password", getStatusFail, em)
}
errMsg += em + " \r\n"
}
}
if res.StatusCode != http.StatusOK {
- return nil, fmt.Errorf("%s Unexpected [%s] status code: %d %s", usersSearchFail, res.Request.URL, res.StatusCode, errMsg)
+ return nil, fmt.Errorf("%s Unexpected [%s] status code: %d %s", getStatusFail, res.Request.URL, res.StatusCode, errMsg)
}
return nil, nil