From 83cc8202b8b99457e6cb0731adf5bf0ea27beebe Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Tue, 23 Feb 2021 17:34:05 +0100 Subject: [PATCH] remove file exists check from `cacheAndReturnMimeType` 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 --- apps/workflowengine/lib/Check/FileMimeType.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/workflowengine/lib/Check/FileMimeType.php b/apps/workflowengine/lib/Check/FileMimeType.php index 8213010af05d8..991d7ebc739ed 100644 --- a/apps/workflowengine/lib/Check/FileMimeType.php +++ b/apps/workflowengine/lib/Check/FileMimeType.php @@ -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 * @@ -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; }