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 sgyuris committed Dec 2, 2024
1 parent abad30e commit 3f07032
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 @@ -563,6 +563,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 3f07032

Please sign in to comment.