From 1ba06e828dbd125ece563f8ed0aaa5c6037b28e2 Mon Sep 17 00:00:00 2001 From: Sylvain Baubeau Date: Fri, 30 Jan 2015 11:57:48 +0100 Subject: [PATCH] Remove prefix in Filelist and RemoveDir --- swift/public.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/swift/public.go b/swift/public.go index 9e40d327..6861ad35 100644 --- a/swift/public.go +++ b/swift/public.go @@ -127,11 +127,15 @@ func (storage *PublishedStorage) Remove(path string) error { func (storage *PublishedStorage) RemoveDirs(path string, progress aptly.Progress) error { path = filepath.Join(storage.prefix, path) opts := swift.ObjectsOpts{ - Prefix: storage.prefix, + Prefix: path, } if objects, err := storage.conn.ObjectNamesAll(storage.container, &opts); err != nil { return fmt.Errorf("error removing dir %s from %s: %s", path, storage, err) } else { + for index, name := range objects { + objects[index] = name[len(storage.prefix):] + } + var multi_delete bool = true if storage.support_bulk_delete { _, err := storage.conn.BulkDelete(storage.container, objects) @@ -199,6 +203,10 @@ func (storage *PublishedStorage) Filelist(prefix string) ([]string, error) { return nil, fmt.Errorf("error listing under prefix %s in %s: %s", prefix, storage, err) } + for index, name := range contents { + contents[index] = name[len(prefix):] + } + return contents, nil }