diff options
author | Björn Schießle <bjoern@schiessle.org> | 2014-11-07 16:20:42 +0100 |
---|---|---|
committer | Björn Schießle <bjoern@schiessle.org> | 2014-11-07 16:20:42 +0100 |
commit | 68a522a8fab302942bfb259e6d00e53d931661e5 (patch) | |
tree | 765d62374722c958713d28fd69fc5c41e847086e | |
parent | fa3b6192ec19340a626712d67710d5a2df691d60 (diff) | |
parent | 2af7256267c8b16efcf68fec45c612d8c64c0c1d (diff) | |
download | nextcloud-server-68a522a8fab302942bfb259e6d00e53d931661e5.tar.gz nextcloud-server-68a522a8fab302942bfb259e6d00e53d931661e5.zip |
Merge pull request #11736 from owncloud/enc_get_fileinfo_from_real_file
if we read a .part file we try to get the file info from the real file
-rw-r--r-- | apps/files_encryption/lib/proxy.php | 4 | ||||
-rw-r--r-- | apps/files_encryption/lib/stream.php | 10 | ||||
-rw-r--r-- | lib/private/files/cache/cache.php | 8 | ||||
-rw-r--r-- | lib/private/files/view.php | 2 |
4 files changed, 14 insertions, 10 deletions
diff --git a/apps/files_encryption/lib/proxy.php b/apps/files_encryption/lib/proxy.php index 31723ae7647..55f2df783c4 100644 --- a/apps/files_encryption/lib/proxy.php +++ b/apps/files_encryption/lib/proxy.php @@ -345,8 +345,8 @@ class Proxy extends \OC_FileProxy { return $size; } - // get file info from database/cache if not .part file - if (empty($fileInfo) && !Helper::isPartialFilePath($path)) { + // get file info from database/cache + if (empty($fileInfo)) { $proxyState = \OC_FileProxy::$enabled; \OC_FileProxy::$enabled = false; $fileInfo = $view->getFileInfo($path); diff --git a/apps/files_encryption/lib/stream.php b/apps/files_encryption/lib/stream.php index 046c38152b8..931aa08cb2c 100644 --- a/apps/files_encryption/lib/stream.php +++ b/apps/files_encryption/lib/stream.php @@ -637,13 +637,17 @@ class Stream { $path = Helper::stripPartialFileExtension($this->rawPath); $fileInfo = array( + 'mimetype' => $this->rootView->getMimeType($this->rawPath), 'encrypted' => true, - 'size' => $this->size, 'unencrypted_size' => $this->unencryptedSize, ); - // set fileinfo - $this->rootView->putFileInfo($path, $fileInfo); + // if we write a part file we also store the unencrypted size for + // the part file so that it can be re-used later + $this->rootView->putFileInfo($this->rawPath, $fileInfo); + if ($path !== $this->rawPath) { + $this->rootView->putFileInfo($path, $fileInfo); + } } diff --git a/lib/private/files/cache/cache.php b/lib/private/files/cache/cache.php index 7ea00325a10..2c12f834518 100644 --- a/lib/private/files/cache/cache.php +++ b/lib/private/files/cache/cache.php @@ -71,7 +71,7 @@ class Cache { if (empty(self::$mimetypeIds)) { $this->loadMimetypes(); } - + if (!isset(self::$mimetypeIds[$mime])) { try{ $result = \OC_DB::executeAudited('INSERT INTO `*PREFIX*mimetypes`(`mimetype`) VALUES(?)', array($mime)); @@ -82,8 +82,8 @@ class Cache { \OC_Log::write('core', 'Exception during mimetype insertion: ' . $e->getmessage(), \OC_Log::DEBUG); return -1; } - } - + } + return self::$mimetypeIds[$mime]; } @@ -371,7 +371,7 @@ class Cache { $this->remove($child['path']); } } - + $sql = 'DELETE FROM `*PREFIX*filecache` WHERE `fileid` = ?'; \OC_DB::executeAudited($sql, array($entry['fileid'])); } diff --git a/lib/private/files/view.php b/lib/private/files/view.php index e15a3063e94..0e4da30f7b9 100644 --- a/lib/private/files/view.php +++ b/lib/private/files/view.php @@ -902,7 +902,7 @@ class View { $scanner = $storage->getScanner($internalPath); $scanner->scan($internalPath, Cache\Scanner::SCAN_SHALLOW); $data = $cache->get($internalPath); - } else if ($watcher->checkUpdate($internalPath, $data)) { + } else if (!Cache\Scanner::isPartialFile($internalPath) && $watcher->checkUpdate($internalPath, $data)) { $this->updater->propagate($path); $data = $cache->get($internalPath); } |