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
tsdicloud committed Aug 19, 2023
2 parents 59f06ac + ad46a63 commit 8e8b188
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 @@ -556,6 +556,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 (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] === 'PROPFIND') {
return $mimeType;
Expand Down

0 comments on commit 8e8b188

Please sign in to comment.