From 848c9d5eb41992ec2d51d0d75f1ec6d7b5ed39c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E5=90=AF=E8=88=AA?= <101104760+ZhangSetSail@users.noreply.github.com> Date: Fri, 22 Nov 2024 00:33:07 +0800 Subject: [PATCH] fix: create route failure (#2077) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 张启航 <101104760+ZhangSetSail@users.noreply.github.com> --- api/controller/apigateway/api_gateway_route.go | 2 +- builder/sources/registry/registry.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/api/controller/apigateway/api_gateway_route.go b/api/controller/apigateway/api_gateway_route.go index ca8b09426..7fa0480b3 100644 --- a/api/controller/apigateway/api_gateway_route.go +++ b/api/controller/apigateway/api_gateway_route.go @@ -248,8 +248,8 @@ func (g Struct) CreateHTTPAPIRoute(w http.ResponseWriter, r *http.Request) { }, v1.CreateOptions{}) if err == nil { name := r.URL.Query().Get("name") - name = name[1:] if name != "" { + name = name[1:] err = c.ApisixRoutes(tenant.Namespace).Delete(r.Context(), name, v1.DeleteOptions{}) if err != nil { logrus.Errorf("delete route %v failure: %v", name, err) diff --git a/builder/sources/registry/registry.go b/builder/sources/registry/registry.go index ef2e63aff..4a0cd3268 100644 --- a/builder/sources/registry/registry.go +++ b/builder/sources/registry/registry.go @@ -129,7 +129,7 @@ func newFromTransport(registryURL, username, password string, transport http.Rou } if err := registry.Ping(); err != nil { - if errors.Is(err, ErrRegistryNotFound) && !containsScheme { + if err != nil { // try again with http url registry.URL = strings.Replace(url, "https", "http", 1) if err := registry.Ping(); err != nil {