Commit 68a522a8 authored by Björn Schießle's avatar Björn Schießle
Browse files

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
parents fa3b6192 2af72562
......@@ -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);
......
......@@ -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);
}
}
......
......@@ -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']));
}
......
......@@ -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);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment