summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2013-11-27 18:48:24 +0100
committerVincent Petry <pvince81@owncloud.com>2013-11-27 21:34:51 +0100
commit43b1cf798839888e9e7266d80f55f6ce6f74d852 (patch)
treef4c37388ce477881e14ffb80f157ae91bfadc466 /lib
parent40231c08cf617b5909dee778372d6b1b8cdd5bcf (diff)
downloadnextcloud-server-43b1cf798839888e9e7266d80f55f6ce6f74d852.tar.gz
nextcloud-server-43b1cf798839888e9e7266d80f55f6ce6f74d852.zip
Redetect mime type whenever extension is renamed
Diffstat (limited to 'lib')
-rw-r--r--lib/private/files/cache/updater.php6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/private/files/cache/updater.php b/lib/private/files/cache/updater.php
index d45c5e17fc8..9ef147aa157 100644
--- a/lib/private/files/cache/updater.php
+++ b/lib/private/files/cache/updater.php
@@ -86,6 +86,12 @@ class Updater {
if ($storageFrom === $storageTo) {
$cache = $storageFrom->getCache($internalFrom);
$cache->move($internalFrom, $internalTo);
+ if (pathinfo($internalFrom, PATHINFO_EXTENSION) !== pathinfo($internalTo, PATHINFO_EXTENSION)) {
+ // redetect mime type change
+ $mimeType = $storageTo->getMimeType($internalTo);
+ $fileId = $storageTo->getCache()->getId($internalTo);
+ $storageTo->getCache()->update($fileId, array('mimetype' => $mimeType));
+ }
$cache->correctFolderSize($internalFrom);
$cache->correctFolderSize($internalTo);
self::correctFolder($from, time());