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
This commit is contained in:
Björn Schießle 2014-11-07 16:20:42 +01:00
commit 68a522a8fa
4 changed files with 14 additions and 10 deletions

View File

@ -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);

View File

@ -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);
}
}

View File

@ -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']));
}

View File

@ -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);
}