You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by ab...@apache.org on 2023/05/24 12:59:47 UTC
[incubator-devlake] branch release-v0.17 updated: fix: invalid endpoint URLs should not pass connection test (#5274)
This is an automated email from the ASF dual-hosted git repository.
abeizn pushed a commit to branch release-v0.17
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git
The following commit(s) were added to refs/heads/release-v0.17 by this push:
new b9dc2cc5c fix: invalid endpoint URLs should not pass connection test (#5274)
b9dc2cc5c is described below
commit b9dc2cc5c25db56f0532ca660a490bbe81e6af43
Author: abeizn <zi...@merico.dev>
AuthorDate: Wed May 24 17:17:31 2023 +0800
fix: invalid endpoint URLs should not pass connection test (#5274)
---
backend/plugins/jenkins/api/connection.go | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/backend/plugins/jenkins/api/connection.go b/backend/plugins/jenkins/api/connection.go
index 4f76ef5e0..0eb22e636 100644
--- a/backend/plugins/jenkins/api/connection.go
+++ b/backend/plugins/jenkins/api/connection.go
@@ -20,6 +20,7 @@ package api
import (
"context"
"net/http"
+ "strings"
"github.com/apache/incubator-devlake/server/api/shared"
@@ -50,6 +51,10 @@ func TestConnection(input *plugin.ApiResourceInput) (*plugin.ApiResourceOutput,
if err != nil {
return nil, err
}
+ // Check if the URL contains "/api"
+ if strings.Contains(connection.Endpoint, "/api") {
+ return nil, errors.HttpStatus(http.StatusBadRequest).New("Invalid URL. Please use the base URL without /api")
+ }
// test connection
apiClient, err := api.NewApiClientFromConnection(context.TODO(), basicRes, &connection)
if err != nil {