diff options
author | Thomas Müller <DeepDiver1975@users.noreply.github.com> | 2016-09-20 11:16:56 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-09-20 11:16:56 +0200 |
commit | 4578afff9ccc32deecbf777eddaa1fee2c69737f (patch) | |
tree | c23bcebdf5a010b3a1208816802c63831ac66d90 /lib | |
parent | a19a1b3c4997d1b972e029bf0543893763855add (diff) | |
download | nextcloud-server-4578afff9ccc32deecbf777eddaa1fee2c69737f.tar.gz nextcloud-server-4578afff9ccc32deecbf777eddaa1fee2c69737f.zip |
[stable8.2] Fix mimetype detection inside hidden folders (#26138) (#26153)
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/files/type/detection.php | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/private/files/type/detection.php b/lib/private/files/type/detection.php index fd27d88eae6..2784e592890 100644 --- a/lib/private/files/type/detection.php +++ b/lib/private/files/type/detection.php @@ -164,9 +164,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] |