From 670fa3aaf72834d402bd61f2d14d460d70dce0b9 Mon Sep 17 00:00:00 2001 From: Yadnesh Kulkarni Date: Sun, 15 Aug 2021 04:21:34 -0400 Subject: [PATCH] Incorrect url to the swift container Swift path prefix in ReadTree and ReadDir should not be empty when adding "/" to it. --- util/pkg/vfs/swiftfs.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/util/pkg/vfs/swiftfs.go b/util/pkg/vfs/swiftfs.go index dbd0c5503e..4155f31ae8 100644 --- a/util/pkg/vfs/swiftfs.go +++ b/util/pkg/vfs/swiftfs.go @@ -487,7 +487,7 @@ func (p *SwiftPath) readPath(opt swiftobject.ListOpts) ([]Path, error) { // ReadDir implements Path::ReadDir. func (p *SwiftPath) ReadDir() ([]Path, error) { prefix := p.key - if !strings.HasSuffix(prefix, "/") { + if prefix != "" && !strings.HasSuffix(prefix, "/") { prefix += "/" } opt := swiftobject.ListOpts{ @@ -500,7 +500,7 @@ func (p *SwiftPath) ReadDir() ([]Path, error) { // ReadTree implements Path::ReadTree. func (p *SwiftPath) ReadTree() ([]Path, error) { prefix := p.key - if !strings.HasSuffix(prefix, "/") { + if prefix != "" && !strings.HasSuffix(prefix, "/") { prefix += "/" } opt := swiftobject.ListOpts{