Skip to content

Commit fd630c9

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 52b99d8 commit fd630c9

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
@@ -524,6 +524,15 @@ public function delete() {
524524
public function getContentType() {
525525
$mimeType = $this->info->getMimetype();
526526

527+
if ($mimeType === 'application/octet-stream') {
528+
$mimeType = \OC::$server->getMimeTypeDetector()->detectPath($this->info->getInternalPath());
529+
if ($this->info->getMimetype() !== $mimeType) {
530+
$this->info->getStorage()->getCache()->update($this->info->getId(), [
531+
'mimetype' => $mimeType
532+
]);
533+
}
534+
}
535+
527536
// PROPFIND needs to return the correct mime type, for consistency with the web UI
528537
if ($this->request->getMethod() === 'PROPFIND') {
529538
return $mimeType;

0 commit comments

Comments
 (0)