diff --git a/apps/files_encryption/lib/proxy.php b/apps/files_encryption/lib/proxy.php index 31723ae7647237f8707598893f668adbd7e446d3..55f2df783c466c367005eed8ec8432f43a9026af 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 046c38152b8702e5072c826be250a724224b0f3d..931aa08cb2cd1f3128a3cf5a8fa30494f62b25db 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 7ea00325a1015d34bb51e9877d2422e66b69f76c..2c12f834518191cdc6ad15dcd5cd89043e924e28 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 e15a3063e94a0e74d776b91a04192896a9f519cd..0e4da30f7b93d55fd7e69428a91d4c02f2caf2d1 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); }