diff options
author | Robin Appelman <robin@icewind.nl> | 2020-07-30 16:11:45 +0200 |
---|---|---|
committer | Robin Appelman <robin@icewind.nl> | 2020-07-30 16:11:45 +0200 |
commit | 8c3b22859c8e76e5cf8c8b18966ad9069a601cac (patch) | |
tree | 269bc52eac6983a391eb419bca4c30e1d9f89f29 /lib | |
parent | a32e6a795868f4d26983b26502d2588b3e6fd80e (diff) | |
download | nextcloud-server-8c3b22859c8e76e5cf8c8b18966ad9069a601cac.tar.gz nextcloud-server-8c3b22859c8e76e5cf8c8b18966ad9069a601cac.zip |
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.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); |