Skip to content

Commit 8a7e03a

Browse files
committed
Merge #253 Fix mimetype for binary files migrated as application/octet-stream
2 parents 75e1f00 + ad46a63 commit 8a7e03a

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
@@ -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)