diff --git a/bundle/libraries/filer_volume.go b/bundle/libraries/filer_volume.go index 7308b65e2..0348ef6fa 100644 --- a/bundle/libraries/filer_volume.go +++ b/bundle/libraries/filer_volume.go @@ -26,9 +26,12 @@ import ( // Returns an error. func filerForVolume(ctx context.Context, b *bundle.Bundle) (filer.Filer, string, diag.Diagnostics) { artifactPath := b.Config.Workspace.ArtifactPath - w := b.WorkspaceClient() + if !strings.HasPrefix(artifactPath, "/Volumes/") { + return nil, "", diag.Errorf("expected artifact_path to start with /Volumes/, got %s", artifactPath) + } + parts := strings.Split(artifactPath, "/") volumeFormatErr := fmt.Errorf("expected UC volume path to be in the format /Volumes////..., got %s", artifactPath) diff --git a/bundle/libraries/filer_volume_test.go b/bundle/libraries/filer_volume_test.go index 82b8ab550..e45a7cb0f 100644 --- a/bundle/libraries/filer_volume_test.go +++ b/bundle/libraries/filer_volume_test.go @@ -174,6 +174,19 @@ func TestFilerForVolumeWithInvalidVolumePaths(t *testing.T) { } } +func TestFilerForVolumeWithInvalidPrefix(t *testing.T) { + b := &bundle.Bundle{ + Config: config.Root{ + Workspace: config.Workspace{ + ArtifactPath: "/Volume/main/my_schema/my_volume", + }, + }, + } + + _, _, diags := filerForVolume(context.Background(), b) + require.EqualError(t, diags.Error(), "expected artifact_path to start with /Volumes/, got /Volume/main/my_schema/my_volume") +} + func TestFilerForVolumeWithValidlVolumePaths(t *testing.T) { validPaths := []string{ "/Volumes/main/my_schema/my_volume",