Skip to content

Commit 02f32d1

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 db7c2ef commit 02f32d1

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
@@ -521,6 +521,15 @@ public function delete() {
521521
public function getContentType() {
522522
$mimeType = $this->info->getMimetype();
523523

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

0 commit comments

Comments
 (0)