Skip to content

Commit 585fc04

Browse files
rhtotmemurats
authored andcommitted
Add patch from Julius "Make sure to properly set the mimetype if the detection has a different one"
1 parent 2128f94 commit 585fc04

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

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

+9
Original file line numberDiff line numberDiff line change
@@ -544,6 +544,15 @@ public function delete() {
544544
public function getContentType() {
545545
$mimeType = $this->info->getMimetype();
546546

547+
if ($mimeType === 'application/octet-stream') {
548+
$mimeType = \OC::$server->getMimeTypeDetector()->detectPath($this->info->getInternalPath());
549+
if ($this->info->getMimetype() !== $mimeType) {
550+
$this->info->getStorage()->getCache()->update($this->info->getId(), [
551+
'mimetype' => $mimeType
552+
]);
553+
}
554+
}
555+
547556
// PROPFIND needs to return the correct mime type, for consistency with the web UI
548557
if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] === 'PROPFIND') {
549558
return $mimeType;

0 commit comments

Comments
 (0)