From 4356c91ffd16f54a7bc67b7c62ef4f1110b29e9f Mon Sep 17 00:00:00 2001
From: Roeland Jago Douma <roeland@famdouma.nl>
Date: Thu, 12 Dec 2019 09:58:22 +0100
Subject: [PATCH] Fix detection of non extention types

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
---
 lib/private/Files/Type/Detection.php | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/lib/private/Files/Type/Detection.php b/lib/private/Files/Type/Detection.php
index cebbccd6ad6..530020fe4b9 100644
--- a/lib/private/Files/Type/Detection.php
+++ b/lib/private/Files/Type/Detection.php
@@ -203,9 +203,12 @@ 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 .
-			return $this->mimetypes[$extension][0] ?? 'application/octet-stream';
+			$extension = strrchr($fileName, '.');
+			if ($extension !== false) {
+				$extension = strtolower($extension);
+				$extension = substr($extension, 1); //remove leading .
+				return $this->mimetypes[$extension][0] ?? 'application/octet-stream';
+			}
 		}
 
 		return 'application/octet-stream';
-- 
GitLab