summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorLukas Reschke <lukas@statuscode.ch>2016-09-27 18:52:48 +0200
committerGitHub <noreply@github.com>2016-09-27 18:52:48 +0200
commitc4d263199c992e890f5b413c26645c1156e0cfe6 (patch)
tree2da78188e6d8f7e13aadc0e24e29a54c0ae72a55 /lib
parent2f488ce3730d3dc8aa0df7b6e57c46478fcf1288 (diff)
parent9b4de310bdfc3eeaafd236124cb17ee58d11c852 (diff)
downloadnextcloud-server-c4d263199c992e890f5b413c26645c1156e0cfe6.tar.gz
nextcloud-server-c4d263199c992e890f5b413c26645c1156e0cfe6.zip
Merge pull request #1521 from nextcloud/fix-mimetypedetect-hiddenfolder
Fix mimetype detection inside hidden folders (#26138)
Diffstat (limited to 'lib')
-rw-r--r--lib/private/Files/Type/Detection.php6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/private/Files/Type/Detection.php b/lib/private/Files/Type/Detection.php
index 66ef0dd2aab..84d727ebb0e 100644
--- a/lib/private/Files/Type/Detection.php
+++ b/lib/private/Files/Type/Detection.php
@@ -166,9 +166,11 @@ class Detection implements IMimeTypeDetector {
public function detectPath($path) {
$this->loadMappings();
- if (strpos($path, '.')) {
+ $fileName = basename($path);
+ // note: leading dot doesn't qualify as extension
+ if (strpos($fileName, '.') > 0) {
//try to guess the type by the file extension
- $extension = strtolower(strrchr(basename($path), "."));
+ $extension = strtolower(strrchr($fileName, '.'));
$extension = substr($extension, 1); //remove leading .
return (isset($this->mimetypes[$extension]) && isset($this->mimetypes[$extension][0]))
? $this->mimetypes[$extension][0]