Implementation of Rename method for S3 PublishedStorage. #15

This commit is contained in:
Andrey Smirnov
2014-07-26 01:11:23 +04:00
parent 8015966663
commit 77d6a10984
2 changed files with 7 additions and 2 deletions
+6 -1
View File
@@ -208,5 +208,10 @@ func (storage *PublishedStorage) Filelist(prefix string) ([]string, error) {
// RenameFile renames (moves) file
func (storage *PublishedStorage) RenameFile(oldName, newName string) error {
panic("not implemented yet")
err := storage.bucket.Copy(filepath.Join(storage.prefix, oldName), filepath.Join(storage.prefix, newName), storage.acl)
if err != nil {
return fmt.Errorf("error copying %s -> %s in %s: %s", oldName, newName, storage, err)
}
return storage.Remove(oldName)
}