From 121ae8b19abc7f695e16e32b47502511d1da1033 Mon Sep 17 00:00:00 2001 From: Christian Haschek Date: Mon, 23 Nov 2015 20:38:39 +0100 Subject: [PATCH] fixed a bug where files woul get saved even though they were not allowed by type --- models/pictsharemodel.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/models/pictsharemodel.php b/models/pictsharemodel.php index 121e51f..d438890 100644 --- a/models/pictsharemodel.php +++ b/models/pictsharemodel.php @@ -308,6 +308,9 @@ class PictshareModel extends Model { $type = $this->getTypeOfFile($url); $type = $this->isTypeAllowed($type); + + if(!$type) + return array('status'=>'ERR','reason'=>'wrong filetype'); $dup_id = $this->isDuplicate($url); if($dup_id) @@ -322,8 +325,7 @@ class PictshareModel extends Model } - if(!$type) - return array('status'=>'ERR','reason'=>'wrong filetype'); + if($dup_id) return array('status'=>'OK','type'=>$type,'hash'=>$hash,'url'=>DOMAINPATH.$hash,'domain'=>DOMAINPATH);