diff --git a/apps/dav/lib/Connector/Sabre/File.php b/apps/dav/lib/Connector/Sabre/File.php index a7cafeb4a5e1a..f62ab3cd73614 100644 --- a/apps/dav/lib/Connector/Sabre/File.php +++ b/apps/dav/lib/Connector/Sabre/File.php @@ -556,6 +556,15 @@ public function delete() { public function getContentType() { $mimeType = $this->info->getMimetype(); + if ($mimeType === 'application/octet-stream') { + $mimeType = \OC::$server->getMimeTypeDetector()->detectPath($this->info->getInternalPath()); + if ($this->info->getMimetype() !== $mimeType) { + $this->info->getStorage()->getCache()->update($this->info->getId(), [ + 'mimetype' => $mimeType + ]); + } + } + // PROPFIND needs to return the correct mime type, for consistency with the web UI if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] === 'PROPFIND') { return $mimeType;