From 17d2bfdc2055e37b0efa62e8639a786c97948124 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Carretero?= <frederic.carretero@veremes.com> Date: Wed, 21 Nov 2018 16:25:54 +0100 Subject: [PATCH] Corrections dans la fonction "deleteFileFromWsDataDirTree" --- vas/rest/class/vmlib/phpUtil.inc | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/vas/rest/class/vmlib/phpUtil.inc b/vas/rest/class/vmlib/phpUtil.inc index da5dbcaa..8bca814b 100755 --- a/vas/rest/class/vmlib/phpUtil.inc +++ b/vas/rest/class/vmlib/phpUtil.inc @@ -451,19 +451,24 @@ function stripslashes_deep($aString) { )); try{ - + $sServerPath = $sPrefix . str_replace($properties['ws_data_dir'], "/ws_data", $sFilePath); + // Suppression du slash de début de ligne. + if (strpos($sServerPath, '/') === 0) + $sServerPath = substr($sServerPath, 1); $aResult = $s3->deleteObject(array( 'Bucket' => $sBucket, - 'Key' => $sPrefix . str_replace($properties['ws_data_dir'], "/ws_data", $sFilePath) + 'Key' => $sServerPath )); }catch(Aws\S3\Exception\S3Exception $e){ writeToErrorLog($e->getMessage()); + return false; } }else{ - unlink($sFilePath); + return unlink($sFilePath); } } + /** *This method upload a file in ws_data. *@file vmlib/phpUtil.inc -- GitLab