From af262ce05de4f792b4bb72017c23fdaded6e4a0c Mon Sep 17 00:00:00 2001 From: "Evers, Martijn" Date: Fri, 15 Mar 2024 16:30:33 +0100 Subject: [PATCH] Prevent non-fully matching paths to match for --path --- pleasant/pleasant.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pleasant/pleasant.go b/pleasant/pleasant.go index 659ff70..da7ed66 100644 --- a/pleasant/pleasant.go +++ b/pleasant/pleasant.go @@ -175,14 +175,14 @@ func GetIdByResourcePath(baseUrl, resourcePath, resourceType, bearerToken string if resourceType == "entry" { for _, c := range j.Credentials { - if c.Path+resourceName == resourcePath { + if c.Path+resourceName == resourcePath && c.Name == resourceName { count++ id = c.Id } } } else if resourceType == "folder" { for _, c := range j.Groups { - if strings.TrimSuffix(c.FullPath, "/") == resourcePath { + if strings.TrimSuffix(c.FullPath, "/") == resourcePath && c.Name == resourceName { count++ id = c.Id } @@ -223,7 +223,7 @@ func GetParentIdByResourcePath(baseUrl, resourcePath, bearerToken string) (strin var id string for _, c := range j.Groups { - if strings.TrimSuffix(c.FullPath, "/") == parentPath { + if strings.TrimSuffix(c.FullPath, "/") == parentPath && c.Name == parentName { count++ id = c.Id }