partkeepr

fork of partkeepr
git clone https://git.e1e0.net/partkeepr.git
Log | Files | Refs | Submodules | README | LICENSE

commit 283c3230523bae95453d0aaf1edb5d0d7103555f
parent 84ff2a7af52e92157456c94b74c99d256d067ebd
Author: Felicitus <felicitus@felicitus.org>
Date:   Thu,  5 Jul 2012 00:50:21 +0200

Don't bail out on invalid mimetypes

Diffstat:
Msrc/backend/PartKeepr/UploadedFile/UploadedFile.php | 9+++++++--
1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/backend/PartKeepr/UploadedFile/UploadedFile.php b/src/backend/PartKeepr/UploadedFile/UploadedFile.php @@ -208,8 +208,13 @@ abstract class UploadedFile extends BaseEntity implements Serializable { * @return string The extension */ public function getExtension () { - list($category, $type) = explode("/", $this->getMimeType()); - return $type; + $data = explode("/", $this->getMimeType()); + + if (array_key_exists(1, $data)) { + return $data[1]; + } else { + return "undefined"; + } } /**