Skip to content

Commit

Permalink
Add patch from Julius "Make sure to properly set the mimetype if the …
Browse files Browse the repository at this point in the history
…detection has a different one"
  • Loading branch information
rhtot authored and tsdicloud committed Jan 15, 2024
1 parent 6f4c7fe commit 48ccf1a
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 @@ -544,6 +544,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 48ccf1a

Please sign in to comment.