From 42f5cd173ac17efd9f043f44790929db5395539b Mon Sep 17 00:00:00 2001
From: Anthony Borghi <anthony.borghi@veremes.com>
Date: Wed, 9 Jan 2019 14:29:26 +0100
Subject: [PATCH] correction extraction d'extension

---
 vas/rest/class/vmlib/files/Files_common.class.inc  | 3 +--
 vas/rest/class/vmlib/files/Files_manager.class.inc | 6 +-----
 2 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/vas/rest/class/vmlib/files/Files_common.class.inc b/vas/rest/class/vmlib/files/Files_common.class.inc
index cd8431f2..4e2ee795 100644
--- a/vas/rest/class/vmlib/files/Files_common.class.inc
+++ b/vas/rest/class/vmlib/files/Files_common.class.inc
@@ -17,9 +17,8 @@ abstract class Files_common {
      *@return Retourne une chaine.
      */
     public function extension($sPath) {
-        $aTemp = explode(".", $sString);
+        $aTemp = explode(".", $sPath);
         $sString = strtolower($aTemp[count($aTemp) - 1]);
-
         return $sString;
     }
 
diff --git a/vas/rest/class/vmlib/files/Files_manager.class.inc b/vas/rest/class/vmlib/files/Files_manager.class.inc
index 0f8e79dc..923aa8af 100644
--- a/vas/rest/class/vmlib/files/Files_manager.class.inc
+++ b/vas/rest/class/vmlib/files/Files_manager.class.inc
@@ -99,16 +99,12 @@ class Files_manager{
                      return $sErrorMsg;
                  }
 
-                 $aTemp = explode("/", $sServerPath);
-
-                 $sFileName = end($aTemp);
+                 $sFileName = $this->getFileName($sServerPath);
                  $sFileExtension = $this->extension($sFileName);
-
                  if (!in_array($sFileExtension, $aForbiddenExtension)) {
                      //Teste si le fichier correspont au format voulu.
                      $bAllowUpload = false;
                      $sFormat = "";
-
                      if (in_array($sFileType, array_keys($aExtension))){
                          if (in_array($sFileExtension, $aExtension[$sFileType])) {
                              $bAllowUpload = true;
-- 
GitLab