Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2020-07-30 17:11:45 +0300
committerRobin Appelman <robin@icewind.nl>2020-07-31 18:33:24 +0300
commitae6357ca6e6583d09f13affa31fca54c5e747a4a (patch)
treef70d7e1775ccce14bdd269d0f4bc9df6b19368e7 /lib
parentc3f2b73a97dc8a349caf9b0d9f1d0d328239d975 (diff)
dont update mimetype when moving to trash
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'lib')
-rw-r--r--lib/private/Files/Cache/Updater.php6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/private/Files/Cache/Updater.php b/lib/private/Files/Cache/Updater.php
index 7c222b31032..b5d8fd0054f 100644
--- a/lib/private/Files/Cache/Updater.php
+++ b/lib/private/Files/Cache/Updater.php
@@ -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);