diff --git a/src/vitis/vas/rest/ws/vitis/FileDownloader.class.inc b/src/vitis/vas/rest/ws/vitis/FileDownloader.class.inc index 42420a50bb25735bd72ab128d38f41bb6728929f..3e7fc84f5336b07f6f368f18566dc11e0fb12747 100755 --- a/src/vitis/vas/rest/ws/vitis/FileDownloader.class.inc +++ b/src/vitis/vas/rest/ws/vitis/FileDownloader.class.inc @@ -143,11 +143,17 @@ class FileDownloader extends Vitis { $sMessage = array("status" => 0, "sMessage" => "This directory can't be replaced by our replacer"); } // check eTag - $sEtag = sha1(file_get_contents($sPath), false); - - if ($sEtag != $this->aValues['eTag']){ + if (file_exists($sPath)) { + $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"); + http_response_code(404); + } + } else { $bReturnFile = false; $sMessage = array("status" => 0, "sMessage" => "This file doesn't exist or the Etag doesn't match"); + http_response_code(404); } }