From: aravind.est Date: Thu, 19 Sep 2024 18:26:14 +0000 (+0100) Subject: Fix the request transformer regex X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F68%2F13368%2F1;p=nonrtric%2Fplt%2Fsme.git 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 --- 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) }