diff --git a/apps/dav/lib/Connector/Sabre/File.php b/apps/dav/lib/Connector/Sabre/File.php index f54fbbdd15aa3..f1a9fd78bbf13 100644 --- a/apps/dav/lib/Connector/Sabre/File.php +++ b/apps/dav/lib/Connector/Sabre/File.php @@ -563,6 +563,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 ($this->request->getMethod() === 'PROPFIND') { return $mimeType;