From d245ebdad4b110aa5a8b55a0ec83eb6c3e6f1a0c Mon Sep 17 00:00:00 2001 From: Anthony Borghi <anthony.borghi@veremes.com> Date: Fri, 19 Oct 2018 11:15:41 +0200 Subject: [PATCH] Modification du File_downloader pour calculer l'Etag dans ws_data --- vas/rest/ws/vitis/File_downloader.class.inc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/vas/rest/ws/vitis/File_downloader.class.inc b/vas/rest/ws/vitis/File_downloader.class.inc index ad119c53..20204691 100644 --- a/vas/rest/ws/vitis/File_downloader.class.inc +++ b/vas/rest/ws/vitis/File_downloader.class.inc @@ -130,7 +130,12 @@ class File_downloader extends Vitis { // modification de $sPath pour aller chercher le fichier dans ws_data $sPath = $this->aProperties["ws_data_dir"] . "/" . $this->aValues["key"]; // check eTag - $bReturnFile = false; + $sEtag = sha1(file_get_contents($sPath), false); + + if ($sEtag != $this->aValues['eTag']){ + $bReturnFile = false; + $sMessage = array("status" => 0, "sMessage" => "This file doesn't exist or the Etag doesn't match"); + } } if($bReturnFile){ -- GitLab