summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorFrank Karlitschek <frank@owncloud.org>2013-11-28 03:46:42 -0800
committerFrank Karlitschek <frank@owncloud.org>2013-11-28 03:46:42 -0800
commitdab3629ff5c65de91813cde6e9adda769ece2609 (patch)
tree45d825c0bcd44ffd306b9d662b758ad7720449fd /lib
parent30b2ed588b76544142fade70f9b849043d54e05a (diff)
parentbc64931cd06a6839e3ecde58e1f671abd44e08db (diff)
downloadnextcloud-server-dab3629ff5c65de91813cde6e9adda769ece2609.tar.gz
nextcloud-server-dab3629ff5c65de91813cde6e9adda769ece2609.zip
Merge pull request #6089 from owncloud/files-mimetyperefreshafterrename
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());