From 461608173f80d8a21af72a25c4139d69b3bc4019 Mon Sep 17 00:00:00 2001 From: Anthony Borghi <anthony.borghi@veremes.com> Date: Thu, 6 Dec 2018 14:36:12 +0100 Subject: [PATCH] Correctifs doublon dans scandir et / manquant dans copyDir --- src/vitis/vas/rest/class/vmlib/files/S3_files.class.inc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/vitis/vas/rest/class/vmlib/files/S3_files.class.inc b/src/vitis/vas/rest/class/vmlib/files/S3_files.class.inc index 17e297a8..76fee87b 100644 --- a/src/vitis/vas/rest/class/vmlib/files/S3_files.class.inc +++ b/src/vitis/vas/rest/class/vmlib/files/S3_files.class.inc @@ -440,7 +440,7 @@ class S3_files implements Files{ foreach ($aList["Contents"] as $aObject){ $sObjectPath = str_replace($sListPrefix, "", $aObject["Key"]); $aObjectPath = explode("/", $sObjectPath); - if(!empty($aObjectPath[0])){ + if(!empty($aObjectPath[0]) && !in_array($aObjectPath[0], $aReturn)){ array_push($aReturn, $aObjectPath[0]); } } @@ -588,6 +588,9 @@ class S3_files implements Files{ } if (substr($sListPrefix, -1) !== "/"){ $sListPrefix .= "/"; + } + if (substr($sListPrefixDest, -1) !== "/"){ + $sListPrefixDest .= "/"; } try{ $aList = $this->oS3Client->listObjectsV2(array( @@ -597,8 +600,6 @@ class S3_files implements Files{ if ($aList["KeyCount"] > 0){ foreach ($aList["Contents"] as $aObject){ - array_push($oDeleteParams["Objects"], array("Key"=>$aObject["Key"])); - $this->oS3Client->copyObject(array( 'Bucket' => $sBucket, 'Key' => str_replace($sListPrefix, $sListPrefixDest, $aObject["Key"]), -- GitLab