summaryrefslogtreecommitdiffstats
path: root/lib/private
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2016-09-19 15:41:44 +0200
committerLukas Reschke <lukas@statuscode.ch>2016-09-26 11:31:03 +0200
commit9b4de310bdfc3eeaafd236124cb17ee58d11c852 (patch)
treeee929c2446d2c5289dd019cdd0be2bb158427dbc /lib/private
parent244de6451b22a1288d3ef698f48fb9c4e78bf15f (diff)
downloadnextcloud-server-9b4de310bdfc3eeaafd236124cb17ee58d11c852.tar.gz
nextcloud-server-9b4de310bdfc3eeaafd236124cb17ee58d11c852.zip
Fix mimetype detection inside hidden folders (#26138)
Downstreaming of https://github.com/owncloud/core/pull/26138 Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
Diffstat (limited to 'lib/private')
-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]