From dddf3369850e984e28766bf817016ef168b808f5 Mon Sep 17 00:00:00 2001
From: ko_oler <kooler89@gmail.com>
Date: Thu, 21 Sep 2023 15:06:08 +0300
Subject: [PATCH] =?UTF-8?q?Parse=20->=20ParseActionURL=20(=D0=B7=D0=B0?=
 =?UTF-8?q?=D0=BC=D0=B5=D0=BD=D0=B5=D0=BD=D0=B0=20=D0=BD=D0=B0=20=D1=84?=
 =?UTF-8?q?=D1=83=D0=BD=D0=BA=D1=86=D0=B8=D1=8E)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 pkg/extension/extension.go | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/pkg/extension/extension.go b/pkg/extension/extension.go
index 5277dd50..f824e327 100644
--- a/pkg/extension/extension.go
+++ b/pkg/extension/extension.go
@@ -130,23 +130,25 @@ func (p *ParsedActionURL) GetScheme() string {
 	return p.scheme
 }
 
-func (p *ParsedActionURL) Parse(action string) error {
+func ParseActionURL(action string) (*ParsedActionURL, error) {
+
 	u, err := url.Parse(action)
 	if err != nil {
-		return err
+		return nil, err
 	}
-	p.scheme = u.Scheme
-	if p.GetScheme() == "grpc" {
+	parsed := &ParsedActionURL{}
+	parsed.scheme = u.Scheme
+	if parsed.GetScheme() == "grpc" {
 		path := u.Path
 		if strings.HasPrefix(u.Path, "/") {
 			path = u.Path[1:]
 		}
 		splitPath := strings.Split(path, "/")
 		if len(splitPath) < 2 {
-			return errors.Errorf("incorrect action URL, no action id: '%s'", action)
+			return nil, errors.Errorf("incorrect action URL, no action id: '%s'", action)
 		}
-		p.extensionID = splitPath[0]
-		p.actionID = splitPath[1]
+		parsed.extensionID = splitPath[0]
+		parsed.actionID = splitPath[1]
 	}
-	return nil
+	return nil, nil
 }
-- 
GitLab