Skip to content

Commit d0acad0

Browse files
committed
dont update mimetype when moving to trash
Signed-off-by: Robin Appelman <robin@icewind.nl>
1 parent de1eaf3 commit d0acad0

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/private/Files/Cache/Updater.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,11 @@ public function renameFromStorage(IStorage $sourceStorage, $source, $target) {
201201
$this->cache->moveFromCache($sourceCache, $source, $target);
202202
}
203203

204-
if (pathinfo($source, PATHINFO_EXTENSION) !== pathinfo($target, PATHINFO_EXTENSION) && $sourceInfo->getMimeType() !== FileInfo::MIMETYPE_FOLDER) {
204+
$sourceExtension = pathinfo($source, PATHINFO_EXTENSION);
205+
$targetExtension = pathinfo($target, PATHINFO_EXTENSION);
206+
$targetIsTrash = preg_match("/d\d+/", $targetExtension);
207+
208+
if ($sourceExtension !== $targetExtension && $sourceInfo->getMimeType() !== FileInfo::MIMETYPE_FOLDER && !$targetIsTrash) {
205209
// handle mime type change
206210
$mimeType = $this->storage->getMimeType($target);
207211
$fileId = $this->cache->getId($target);

0 commit comments

Comments
 (0)