Skip to content

Commit a9094e8

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 d219b74 commit a9094e8

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
@@ -531,6 +531,15 @@ public function delete() {
531531
public function getContentType() {
532532
$mimeType = $this->info->getMimetype();
533533

534+
if ($mimeType === 'application/octet-stream') {
535+
$mimeType = \OC::$server->getMimeTypeDetector()->detectPath($this->info->getInternalPath());
536+
if ($this->info->getMimetype() !== $mimeType) {
537+
$this->info->getStorage()->getCache()->update($this->info->getId(), [
538+
'mimetype' => $mimeType
539+
]);
540+
}
541+
}
542+
534543
// PROPFIND needs to return the correct mime type, for consistency with the web UI
535544
if ($this->request->getMethod() === 'PROPFIND') {
536545
return $mimeType;

0 commit comments

Comments
 (0)