From c743af30d6dd5b76f42f8dc76a23ccfacf494352 Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Thu, 12 Dec 2019 09:58:22 +0100 Subject: [PATCH] Fix detection of non extention types Signed-off-by: Roeland Jago Douma --- lib/private/Files/Type/Detection.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/private/Files/Type/Detection.php b/lib/private/Files/Type/Detection.php index 2801bfadd1..ebd28e7cd2 100644 --- a/lib/private/Files/Type/Detection.php +++ b/lib/private/Files/Type/Detection.php @@ -181,8 +181,11 @@ class Detection implements IMimeTypeDetector { $fileName = preg_replace('!((\.v\d+)|((\.ocTransferId\d+)?\.part))$!', '', $fileName); //try to guess the type by the file extension - $extension = strtolower(strrchr($fileName, '.')); - $extension = substr($extension, 1); //remove leading . + $extension = strrchr($fileName, '.'); + if ($extension !== false) { + $extension = strtolower($extension); + $extension = substr($extension, 1); //remove leading . + } return (isset($this->mimetypes[$extension]) && isset($this->mimetypes[$extension][0])) ? $this->mimetypes[$extension][0] : 'application/octet-stream';