Fix detection of non extention types

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
This commit is contained in:
Roeland Jago Douma 2019-12-12 09:58:22 +01:00
parent 8473a09499
commit 4356c91ffd
No known key found for this signature in database
GPG Key ID: F941078878347C0C
1 changed files with 6 additions and 3 deletions

View File

@ -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';