diff --git a/vas/rest/class/vmlib/files/S3_files.class.inc b/vas/rest/class/vmlib/files/S3_files.class.inc index 76fee87b14586e95b6e0fdaece92fa5f6947714e..ead65c2a01d43903530db35c414cbc3a23a55c1c 100644 --- a/vas/rest/class/vmlib/files/S3_files.class.inc +++ b/vas/rest/class/vmlib/files/S3_files.class.inc @@ -51,6 +51,9 @@ class S3_files implements Files{ public function getFileEtag($sFilePath){ list($sBucket, $sPrefix) = $this->getBucketConst(); $sFilePath = str_replace($this->oProperties["vas_home"], $sPrefix , $sFilePath); + // Suppression du slash de début de ligne. + if (strpos($sFilePath, '/') === 0) + $sFilePath = substr($sFilePath, 1); try { $oResult = $this->oS3Client->headObject(array( @@ -73,6 +76,9 @@ class S3_files implements Files{ list($sBucket, $sPrefix) = $this->getBucketConst(); $sFilePath = str_replace($this->oProperties["vas_home"], $sPrefix , $sFilePath); + // Suppression du slash de début de ligne. + if (strpos($sFilePath, '/') === 0) + $sFilePath = substr($sFilePath, 1); try { $this->oS3Client->headObject(array( @@ -96,6 +102,9 @@ class S3_files implements Files{ public function file_put_contents ($sFilePath, $sData, $iFlags = 0, $mContext = null){ list($sBucket, $sPrefix) = $this->getBucketConst(); $sFilePath = str_replace($this->oProperties["vas_home"], $sPrefix , $sFilePath); + // Suppression du slash de début de ligne. + if (strpos($sFilePath, '/') === 0) + $sFilePath = substr($sFilePath, 1); try { $this->oS3Client->putObject(array( @@ -123,6 +132,9 @@ class S3_files implements Files{ list($sBucket, $sPrefix) = $this->getBucketConst(); $sFilePath = str_replace($this->oProperties["vas_home"], $sPrefix , $sFilePath); + // Suppression du slash de début de ligne. + if (strpos($sFilePath, '/') === 0) + $sFilePath = substr($sFilePath, 1); $sPath = $this->oProperties['extract_dir'] . "/" . getUniqRandomId(); @@ -161,6 +173,9 @@ class S3_files implements Files{ public function file_get_contents_with_etag ($sFilePath, $sEtag ,$bUseIncludePath = FALSE, $mContext = null, $iOffset = 0, $iMaxLen = -1){ list($sBucket, $sPrefix) = $this->getBucketConst(); $sFilePath = str_replace($this->oProperties["vas_home"], $sPrefix , $sFilePath); + // Suppression du slash de début de ligne. + if (strpos($sFilePath, '/') === 0) + $sFilePath = substr($sFilePath, 1); $sPath = $this->oProperties['extract_dir'] . "/" . getUniqRandomId(); @@ -196,7 +211,12 @@ class S3_files implements Files{ list($sBucket, $sPrefix) = $this->getBucketConst(); $sDestFilePath = str_replace($this->oProperties["vas_home"], $sPrefix , $sDestFilePath); $sSourceFilePath = str_replace($this->oProperties["vas_home"], $sPrefix , $sSourceFilePath); - + // Suppression du slash de début de ligne. + if (strpos($sDestFilePath, '/') === 0) + $sDestFilePath = substr($sDestFilePath, 1); + if (strpos($sSourceFilePath, '/') === 0) + $sSourceFilePath = substr($sSourceFilePath, 1); + // try{ $this->oS3Client->copyObject(array( 'Bucket' => $sBucket, @@ -219,6 +239,11 @@ class S3_files implements Files{ public function copyInAnotherBucket ($sSourceFilePath, $sDests3Key, $sDestBucket){ list($sBucket, $sPrefix) = $this->getBucketConst(); $sSourceFilePath = str_replace($this->oProperties["vas_home"], $sPrefix , $sSourceFilePath); + // Suppression du slash de début de ligne. + if (strpos($sSourceFilePath, '/') === 0) + $sSourceFilePath = substr($sSourceFilePath, 1); + if (strpos($sDests3Key, '/') === 0) + $sDests3Key = substr($sDests3Key, 1); try{ $this->oS3Client->copyObject(array( @@ -241,6 +266,9 @@ class S3_files implements Files{ public function copyLocalToS3 ($sSourceFilePath, $sDestFilePath){ list($sBucket, $sPrefix) = $this->getBucketConst(); $sDestFilePath = str_replace($this->oProperties["vas_home"], $sPrefix , $sDestFilePath); + // Suppression du slash de début de ligne. + if (strpos($sDestFilePath, '/') === 0) + $sDestFilePath = substr($sDestFilePath, 1); try { $this->oS3Client->putObject(array( @@ -263,6 +291,9 @@ class S3_files implements Files{ public function filesize ($sFilePath){ list($sBucket, $sPrefix) = $this->getBucketConst(); $sFilePath = str_replace($this->oProperties["vas_home"], $sPrefix , $sFilePath); + // Suppression du slash de début de ligne. + if (strpos($sFilePath, '/') === 0) + $sFilePath = substr($sFilePath, 1); try { $oResult = $this->oS3Client->headObject(array( @@ -286,6 +317,9 @@ class S3_files implements Files{ public function readfile ($sFilePath, $bUseIncludePath = FALSE, $mContext = null){ list($sBucket, $sPrefix) = $this->getBucketConst(); $sFilePath = str_replace($this->oProperties["vas_home"], $sPrefix , $sFilePath); + // Suppression du slash de début de ligne. + if (strpos($sFilePath, '/') === 0) + $sFilePath = substr($sFilePath, 1); $sPath = $this->oProperties['extract_dir'] . "/" . getUniqRandomId(); @@ -327,6 +361,9 @@ class S3_files implements Files{ public function unlink ($sFilePath, $mContext = null){ list($sBucket, $sPrefix) = $this->getBucketConst(); $sFilePath = str_replace($this->oProperties["vas_home"], $sPrefix , $sFilePath); + // Suppression du slash de début de ligne. + if (strpos($sFilePath, '/') === 0) + $sFilePath = substr($sFilePath, 1); try{ $this->oS3Client->deleteObject(array( @@ -347,6 +384,9 @@ class S3_files implements Files{ public function filemtime ($sFilePath){ list($sBucket, $sPrefix) = $this->getBucketConst(); $sFilePath = str_replace($this->oProperties["vas_home"], $sPrefix , $sFilePath); + // Suppression du slash de début de ligne. + if (strpos($sFilePath, '/') === 0) + $sFilePath = substr($sFilePath, 1); try { $oResult = $this->oS3Client->headObject(array(