Skip to content

Commit

Permalink
Merge #253 Fix mimetype for binary files migrated as application/octe…
Browse files Browse the repository at this point in the history
…t-stream
  • Loading branch information
memurats committed Mar 28, 2024
2 parents bc6326a + ad46a63 commit b3d244a
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions apps/dav/lib/Connector/Sabre/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,15 @@ public function delete() {
public function getContentType() {
$mimeType = $this->info->getMimetype();

if ($mimeType === 'application/octet-stream') {
$mimeType = \OC::$server->getMimeTypeDetector()->detectPath($this->info->getInternalPath());
if ($this->info->getMimetype() !== $mimeType) {
$this->info->getStorage()->getCache()->update($this->info->getId(), [
'mimetype' => $mimeType
]);
}
}

// PROPFIND needs to return the correct mime type, for consistency with the web UI
if ($this->request->getMethod() === 'PROPFIND') {
return $mimeType;
Expand Down

0 comments on commit b3d244a

Please sign in to comment.