]> source.dussan.org Git - nextcloud-server.git/commitdiff
dont update mimetype when moving to trash
authorRobin Appelman <robin@icewind.nl>
Thu, 30 Jul 2020 14:11:45 +0000 (16:11 +0200)
committerRobin Appelman <robin@icewind.nl>
Fri, 31 Jul 2020 15:33:24 +0000 (17:33 +0200)
Signed-off-by: Robin Appelman <robin@icewind.nl>
lib/private/Files/Cache/Updater.php

index 7c222b310326b8cdfee55ca3a1d2ab34a7cba6ef..b5d8fd0054fb7af6b691ba104c93e317118997e7 100644 (file)
@@ -201,7 +201,11 @@ class Updater implements IUpdater {
                                $this->cache->moveFromCache($sourceCache, $source, $target);
                        }
 
-                       if (pathinfo($source, PATHINFO_EXTENSION) !== pathinfo($target, PATHINFO_EXTENSION) && $sourceInfo->getMimeType() !== FileInfo::MIMETYPE_FOLDER) {
+                       $sourceExtension = pathinfo($source, PATHINFO_EXTENSION);
+                       $targetExtension = pathinfo($target, PATHINFO_EXTENSION);
+                       $targetIsTrash = preg_match("/d\d+/", $targetExtension);
+
+                       if ($sourceExtension !== $targetExtension && $sourceInfo->getMimeType() !== FileInfo::MIMETYPE_FOLDER && !$targetIsTrash) {
                                // handle mime type change
                                $mimeType = $this->storage->getMimeType($target);
                                $fileId = $this->cache->getId($target);