diff options
author | Robin Appelman <robin@icewind.nl> | 2020-07-30 16:11:45 +0200 |
---|---|---|
committer | Robin Appelman <robin@icewind.nl> | 2020-07-31 17:21:02 +0200 |
commit | 4e6719b28c5bc5f4367af128e1ed731a1f3e6c4d (patch) | |
tree | 3e5dc4858f94888d15dc995c289bb2fc9fa63664 | |
parent | 142b6eb08f5e274c80943ae6d70922bba2f25e83 (diff) | |
download | nextcloud-server-4e6719b28c5bc5f4367af128e1ed731a1f3e6c4d.tar.gz nextcloud-server-4e6719b28c5bc5f4367af128e1ed731a1f3e6c4d.zip |
dont update mimetype when moving to trash
Signed-off-by: Robin Appelman <robin@icewind.nl>
-rw-r--r-- | lib/private/Files/Cache/Updater.php | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/private/Files/Cache/Updater.php b/lib/private/Files/Cache/Updater.php index b6a0e62a88a..79501d910e5 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); |