From 015c3d23c73b38feaff7e6d3c9c45cd4db1596fe Mon Sep 17 00:00:00 2001 From: "aravind.est" Date: Thu, 19 Sep 2024 19:26:14 +0100 Subject: [PATCH] Fix the request transformer regex Request transformer regex fixed to match the continuous path parameters. Issue-ID: NONRTRIC-1031 Change-Id: I6b7f0f2ffcfead5fc6f9541077cc262323813a5f Signed-off-by: aravind.est --- servicemanager/internal/publishserviceapi/typeupdate.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/servicemanager/internal/publishserviceapi/typeupdate.go b/servicemanager/internal/publishserviceapi/typeupdate.go index 72a987d..ac84c0d 100644 --- a/servicemanager/internal/publishserviceapi/typeupdate.go +++ b/servicemanager/internal/publishserviceapi/typeupdate.go @@ -621,14 +621,14 @@ func deriveTransformPattern(routePattern string) (string, error) { } // Regular expression to match named capture groups - re := regexp.MustCompile(`/\(\?<([^>]+)>([^\/]+)/`) + re := regexp.MustCompile(`\(\?<([^>]+)>([^\/]+)`) // Find all matches in the route pattern matches := re.FindAllStringSubmatch(routePattern, -1) transformPattern := routePattern for _, match := range matches { // match[0] is the full match, match[1] is the capture group name, match[2] is the pattern - placeholder := fmt.Sprintf("/$(uri_captures[\"%s\"])/", match[1]) + placeholder := fmt.Sprintf("$(uri_captures[\"%s\"])", match[1]) // Replace the capture group with the corresponding placeholder transformPattern = strings.Replace(transformPattern, match[0], placeholder, 1) } -- 2.16.6