From 20f33d63979c1188a4c472434491d4374a837b4a Mon Sep 17 00:00:00 2001 From: Andrew Nester Date: Thu, 10 Oct 2024 15:24:52 +0200 Subject: [PATCH] fixes --- bundle/permissions/workspace_root.go | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/bundle/permissions/workspace_root.go b/bundle/permissions/workspace_root.go index 3f3f0785..25447fbf 100644 --- a/bundle/permissions/workspace_root.go +++ b/bundle/permissions/workspace_root.go @@ -58,28 +58,34 @@ func giveAccessForWorkspaceRoot(ctx context.Context, b *bundle.Bundle) error { return err } - if !strings.HasPrefix(b.Config.Workspace.ArtifactPath, b.Config.Workspace.RootPath) { + // Adding backslash to the root path + rootPath := b.Config.Workspace.RootPath + if rootPath[len(rootPath)-1] != '/' { + rootPath += "/" + } + + if !strings.HasPrefix(b.Config.Workspace.ArtifactPath, rootPath) { err = setPermissions(ctx, w, b.Config.Workspace.ArtifactPath, permissions) if err != nil { return err } } - if !strings.HasPrefix(b.Config.Workspace.FilePath, b.Config.Workspace.RootPath) { + if !strings.HasPrefix(b.Config.Workspace.FilePath, rootPath) { err = setPermissions(ctx, w, b.Config.Workspace.FilePath, permissions) if err != nil { return err } } - if !strings.HasPrefix(b.Config.Workspace.StatePath, b.Config.Workspace.RootPath) { + if !strings.HasPrefix(b.Config.Workspace.StatePath, rootPath) { err = setPermissions(ctx, w, b.Config.Workspace.StatePath, permissions) if err != nil { return err } } - if !strings.HasPrefix(b.Config.Workspace.ResourcePath, b.Config.Workspace.RootPath) { + if !strings.HasPrefix(b.Config.Workspace.ResourcePath, rootPath) { err = setPermissions(ctx, w, b.Config.Workspace.ResourcePath, permissions) if err != nil { return err