fix renameFromStorage messing with folder mimetype
Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
parent
ad7798f9c9
commit
c8cf2e8a5b
|
@ -28,6 +28,7 @@
|
||||||
|
|
||||||
namespace OC\Files\Cache;
|
namespace OC\Files\Cache;
|
||||||
|
|
||||||
|
use OC\Files\FileInfo;
|
||||||
use OCP\Files\Cache\ICacheEntry;
|
use OCP\Files\Cache\ICacheEntry;
|
||||||
use OCP\Files\Cache\IUpdater;
|
use OCP\Files\Cache\IUpdater;
|
||||||
use OCP\Files\Storage\IStorage;
|
use OCP\Files\Storage\IStorage;
|
||||||
|
@ -187,7 +188,9 @@ class Updater implements IUpdater {
|
||||||
$sourceUpdater = $sourceStorage->getUpdater();
|
$sourceUpdater = $sourceStorage->getUpdater();
|
||||||
$sourcePropagator = $sourceStorage->getPropagator();
|
$sourcePropagator = $sourceStorage->getPropagator();
|
||||||
|
|
||||||
if ($sourceCache->inCache($source)) {
|
$sourceInfo = $sourceCache->get($source);
|
||||||
|
|
||||||
|
if ($sourceInfo !== false) {
|
||||||
if ($this->cache->inCache($target)) {
|
if ($this->cache->inCache($target)) {
|
||||||
$this->cache->remove($target);
|
$this->cache->remove($target);
|
||||||
}
|
}
|
||||||
|
@ -197,14 +200,14 @@ class Updater implements IUpdater {
|
||||||
} else {
|
} else {
|
||||||
$this->cache->moveFromCache($sourceCache, $source, $target);
|
$this->cache->moveFromCache($sourceCache, $source, $target);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (pathinfo($source, PATHINFO_EXTENSION) !== pathinfo($target, PATHINFO_EXTENSION)) {
|
if (pathinfo($source, PATHINFO_EXTENSION) !== pathinfo($target, PATHINFO_EXTENSION) && $sourceInfo->getMimeType() !== FileInfo::MIMETYPE_FOLDER) {
|
||||||
// handle mime type change
|
// handle mime type change
|
||||||
$mimeType = $this->storage->getMimeType($target);
|
$mimeType = $this->storage->getMimeType($target);
|
||||||
$fileId = $this->cache->getId($target);
|
$fileId = $this->cache->getId($target);
|
||||||
$this->cache->update($fileId, ['mimetype' => $mimeType]);
|
$this->cache->update($fileId, ['mimetype' => $mimeType]);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($sourceCache instanceof Cache) {
|
if ($sourceCache instanceof Cache) {
|
||||||
$sourceCache->correctFolderSize($source);
|
$sourceCache->correctFolderSize($source);
|
||||||
|
|
Loading…
Reference in New Issue