This is an automated email from the ASF dual-hosted git repository.
warren pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git
The following commit(s) were added to refs/heads/main by this push:
new 0beb2ef94 fix: fix the jenkins 404 error (#4020)
0beb2ef94 is described below
commit 0beb2ef94bf452e47938e7be1f99d947ebc6b0f4
Author: mindlesscloud <[email protected]>
AuthorDate: Fri Dec 23 16:30:44 2022 +0800
fix: fix the jenkins 404 error (#4020)
---
plugins/jenkins/api/scope.go | 8 +++++---
plugins/jenkins/impl/impl.go | 2 +-
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/plugins/jenkins/api/scope.go b/plugins/jenkins/api/scope.go
index c3615d9b8..da9f35e28 100644
--- a/plugins/jenkins/api/scope.go
+++ b/plugins/jenkins/api/scope.go
@@ -20,6 +20,7 @@ package api
import (
"net/http"
"strconv"
+ "strings"
"github.com/apache/incubator-devlake/errors"
"github.com/apache/incubator-devlake/plugins/core"
@@ -121,7 +122,7 @@ func UpdateScope(input *core.ApiResourceInput)
(*core.ApiResourceOutput, errors.
// @Success 200 {object} []apiJob
// @Failure 400 {object} shared.ApiBody "Bad Request"
// @Failure 500 {object} shared.ApiBody "Internal Error"
-// @Router /plugins/jenkins/connections/{connectionId}/scopes/ [GET]
+// @Router /plugins/jenkins/connections/{connectionId}/scopes [GET]
func GetScopeList(input *core.ApiResourceInput) (*core.ApiResourceOutput,
errors.Error) {
var jobs []models.JenkinsJob
connectionId, _ := strconv.ParseUint(input.Params["connectionId"], 10,
64)
@@ -196,8 +197,9 @@ func extractParam(params map[string]string) (uint64,
string, errors.Error) {
if connectionId == 0 {
return 0, "", errors.BadInput.New("invalid connectionId")
}
- if params["fullName"] == "" {
+ fullName := strings.TrimLeft(params["fullName"], "/")
+ if fullName == "" {
return 0, "", errors.BadInput.New("invalid fullName")
}
- return connectionId, params["fullName"], nil
+ return connectionId, fullName, nil
}
diff --git a/plugins/jenkins/impl/impl.go b/plugins/jenkins/impl/impl.go
index 973b5e89d..7efda62d0 100644
--- a/plugins/jenkins/impl/impl.go
+++ b/plugins/jenkins/impl/impl.go
@@ -173,7 +173,7 @@ func (plugin Jenkins) ApiResources()
map[string]map[string]core.ApiResourceHandl
"DELETE": api.DeleteConnection,
"GET": api.GetConnection,
},
- "connections/:connectionId/scopes/:fullName": {
+ "connections/:connectionId/scopes/*fullName": {
"GET": api.GetScope,
"PATCH": api.UpdateScope,
},