Skip to content

Commit ad46a63

Browse files
rhtottsdicloud
authored andcommitted
Add patch from Julius "Make sure to properly set the mimetype if the detection has a different one"
1 parent ab27e95 commit ad46a63

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
@@ -556,6 +556,15 @@ public function delete() {
556556
public function getContentType() {
557557
$mimeType = $this->info->getMimetype();
558558

559+
if ($mimeType === 'application/octet-stream') {
560+
$mimeType = \OC::$server->getMimeTypeDetector()->detectPath($this->info->getInternalPath());
561+
if ($this->info->getMimetype() !== $mimeType) {
562+
$this->info->getStorage()->getCache()->update($this->info->getId(), [
563+
'mimetype' => $mimeType
564+
]);
565+
}
566+
}
567+
559568
// PROPFIND needs to return the correct mime type, for consistency with the web UI
560569
if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] === 'PROPFIND') {
561570
return $mimeType;

0 commit comments

Comments
 (0)