浏览代码

HUE-5322 [fb] Moving/Copying a folder in S3 results in duplicate children files at target

Jenny Kim 9 年之前
父节点
当前提交
480dc29
共有 2 个文件被更改,包括 5 次插入3 次删除
  1. 0 2
      desktop/libs/aws/src/aws/s3/s3fs.py
  2. 5 1
      desktop/libs/aws/src/aws/s3/s3fs_test.py

+ 0 - 2
desktop/libs/aws/src/aws/s3/s3fs.py

@@ -395,8 +395,6 @@ class S3FileSystem(object):
   def rename(self, old, new):
     new = s3.abspath(old, new)
     self.copy(old, new, recursive=True)
-    if self.isdir(old):
-      self.rename_star(old, new)
     self.rmtree(old, skipTrash=True)
 
   @translate_s3_error

+ 5 - 1
desktop/libs/aws/src/aws/s3/s3fs_test.py

@@ -222,8 +222,12 @@ class S3FSTest(S3TestBase):
       assert_true('file_one.txt' in dst_ls)
       assert_true('file_two.txt' in dst_ls)
 
-      # Assert that only the renamed directory, and not an empty file, exists
+      # Assert that the children files are not duplicated at top-level destination
       bucket_ls = self.bucket.list()
+      assert_false('file_one.txt' in bucket_ls)
+      assert_false('file_two.txt' in bucket_ls)
+
+      # Assert that only the renamed directory, and not an empty file, exists
       assert_equal(1, len([key for key in bucket_ls if key.name.strip('/') == self.get_key(dst_dir).name.strip('/')]))