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
gsztupov committed Mar 8, 2024
2 parents 1f0289b + ad46a63 commit 1006be5
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 1006be5

Please sign in to comment.