Skip to content

Commit 510f67c

Browse files
committed
Merge #253 Fix mimetype for binary files migrated as application/octet-stream
2 parents e7c9074 + ad46a63 commit 510f67c

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

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

0 commit comments

Comments
 (0)