Skip to content

Commit 88d6f51

Browse files
rhtotsgyuris
authored andcommitted
Add patch from Julius "Make sure to properly set the mimetype if the detection has a different one"
1 parent e233c73 commit 88d6f51

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

apps/dav/lib/Connector/Sabre/File.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -563,6 +563,15 @@ public function delete() {
563563
public function getContentType() {
564564
$mimeType = $this->info->getMimetype();
565565

566+
if ($mimeType === 'application/octet-stream') {
567+
$mimeType = \OC::$server->getMimeTypeDetector()->detectPath($this->info->getInternalPath());
568+
if ($this->info->getMimetype() !== $mimeType) {
569+
$this->info->getStorage()->getCache()->update($this->info->getId(), [
570+
'mimetype' => $mimeType
571+
]);
572+
}
573+
}
574+
566575
// PROPFIND needs to return the correct mime type, for consistency with the web UI
567576
if ($this->request->getMethod() === 'PROPFIND') {
568577
return $mimeType;

0 commit comments

Comments
 (0)