aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJohn Molakvoæ <skjnldsv@users.noreply.github.com>2024-12-11 08:40:58 +0100
committerGitHub <noreply@github.com>2024-12-11 08:40:58 +0100
commit3baa91d8421286952cf1973a7d5d49066484b08a (patch)
treeee28e265e7553e5a11ec628fd93d7ea420fee8dd /lib
parented54713e6abf1b2428f37ca322100bab6a6301be (diff)
parent37199779de89674790b36eb6b0a863b2e6eb567b (diff)
downloadnextcloud-server-3baa91d8421286952cf1973a7d5d49066484b08a.tar.gz
nextcloud-server-3baa91d8421286952cf1973a7d5d49066484b08a.zip
Merge pull request #40394 from nextcloud/updater-change-mimetype-objectstore
Diffstat (limited to 'lib')
-rw-r--r--lib/private/Files/Cache/Updater.php22
1 files changed, 13 insertions, 9 deletions
diff --git a/lib/private/Files/Cache/Updater.php b/lib/private/Files/Cache/Updater.php
index 1280a2ae267..42812dbc882 100644
--- a/lib/private/Files/Cache/Updater.php
+++ b/lib/private/Files/Cache/Updater.php
@@ -213,21 +213,25 @@ class Updater implements IUpdater {
$sourceInfo = $sourceCache->get($source);
+ $sourceExtension = pathinfo($source, PATHINFO_EXTENSION);
+ $targetExtension = pathinfo($target, PATHINFO_EXTENSION);
+ $targetIsTrash = preg_match("/^d\d+$/", $targetExtension);
+
if ($sourceInfo !== false) {
if (!$this->storage->instanceOfStorage(ObjectStoreStorage::class)) {
$operation($sourceCache, $sourceInfo);
}
- $sourceExtension = pathinfo($source, PATHINFO_EXTENSION);
- $targetExtension = pathinfo($target, PATHINFO_EXTENSION);
- $targetIsTrash = preg_match("/d\d+/", $targetExtension);
+ $isDir = $sourceInfo->getMimeType() === FileInfo::MIMETYPE_FOLDER;
+ } else {
+ $isDir = $this->storage->is_dir($target);
+ }
- if ($sourceExtension !== $targetExtension && $sourceInfo->getMimeType() !== FileInfo::MIMETYPE_FOLDER && !$targetIsTrash) {
- // handle mime type change
- $mimeType = $this->storage->getMimeType($target);
- $fileId = $this->cache->getId($target);
- $this->cache->update($fileId, ['mimetype' => $mimeType]);
- }
+ if ($sourceExtension !== $targetExtension && !$isDir && !$targetIsTrash) {
+ // handle mime type change
+ $mimeType = $this->storage->getMimeType($target);
+ $fileId = $this->cache->getId($target);
+ $this->cache->update($fileId, ['mimetype' => $mimeType]);
}
if ($sourceCache instanceof Cache) {