Skip to content

Commit

Permalink
remove file exists check from cacheAndReturnMimeType
Browse files Browse the repository at this point in the history
the method is only called if the file exists already

a check against storing the fallback mimetype is added as a safety instead

Signed-off-by: Robin Appelman <[email protected]>
  • Loading branch information
icewind1991 authored and PVince81 committed Dec 20, 2022
1 parent c5a8246 commit 83cc820
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions apps/workflowengine/lib/Check/FileMimeType.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public function setFileInfo(IStorage $storage, string $path, bool $isDir = false
}

/**
* The mimetype is only cached if the file exists. Otherwise files access
* The mimetype is only cached if the file has a valid mimetype. Otherwise files access
* control will cache "application/octet-stream" for all the target node on:
* rename, move, copy and all other methods which create a new item
*
Expand All @@ -92,7 +92,7 @@ public function setFileInfo(IStorage $storage, string $path, bool $isDir = false
* @return string
*/
protected function cacheAndReturnMimeType(string $storageId, ?string $path, string $mimeType): string {
if ($path !== null && $this->storage->file_exists($path)) {
if ($path !== null && $mimeType !== 'application/octet-stream') {
$this->mimeType[$storageId][$path] = $mimeType;
}

Expand Down

0 comments on commit 83cc820

Please sign in to comment.