Skip to content

Commit 00863e2

Browse files
committed
Merge #253 Fix mimetype for binary files migrated as application/octet-stream
2 parents cd583c1 + ad46a63 commit 00863e2

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
@@ -567,6 +567,15 @@ public function delete() {
567567
public function getContentType() {
568568
$mimeType = $this->info->getMimetype();
569569

570+
if ($mimeType === 'application/octet-stream') {
571+
$mimeType = \OC::$server->getMimeTypeDetector()->detectPath($this->info->getInternalPath());
572+
if ($this->info->getMimetype() !== $mimeType) {
573+
$this->info->getStorage()->getCache()->update($this->info->getId(), [
574+
'mimetype' => $mimeType
575+
]);
576+
}
577+
}
578+
570579
// PROPFIND needs to return the correct mime type, for consistency with the web UI
571580
if ($this->request->getMethod() === 'PROPFIND') {
572581
return $mimeType;

0 commit comments

Comments
 (0)