diff --git a/apps/dav/lib/Connector/Sabre/File.php b/apps/dav/lib/Connector/Sabre/File.php index 4f1cde334d9bd..bd338e751bcc6 100644 --- a/apps/dav/lib/Connector/Sabre/File.php +++ b/apps/dav/lib/Connector/Sabre/File.php @@ -544,6 +544,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;