don't ask for fileInfo if we already have one
This commit is contained in:
parent
cda87fd9c4
commit
3a698bce6e
1 changed files with 4 additions and 5 deletions
|
@ -275,7 +275,7 @@ class Proxy extends \OC_FileProxy {
|
|||
\OC_FileProxy::$enabled = false;
|
||||
|
||||
// get file size
|
||||
$data['size'] = self::postFileSize($path, $data['size']);
|
||||
$data['size'] = self::postFileSize($path, $data['size'], $data);
|
||||
|
||||
// Re-enable the proxy
|
||||
\OC_FileProxy::$enabled = $proxyStatus;
|
||||
|
@ -289,7 +289,7 @@ class Proxy extends \OC_FileProxy {
|
|||
* @param int $size
|
||||
* @return int|bool
|
||||
*/
|
||||
public function postFileSize($path, $size) {
|
||||
public function postFileSize($path, $size, $fileInfo = null) {
|
||||
|
||||
$view = new \OC\Files\View('/');
|
||||
|
||||
|
@ -323,9 +323,8 @@ class Proxy extends \OC_FileProxy {
|
|||
return $size;
|
||||
}
|
||||
|
||||
$fileInfo = false;
|
||||
// get file info from database/cache if not .part file
|
||||
if (!Helper::isPartialFilePath($path)) {
|
||||
if (empty($fileInfo) && !Helper::isPartialFilePath($path)) {
|
||||
$proxyState = \OC_FileProxy::$enabled;
|
||||
\OC_FileProxy::$enabled = false;
|
||||
$fileInfo = $view->getFileInfo($path);
|
||||
|
@ -333,7 +332,7 @@ class Proxy extends \OC_FileProxy {
|
|||
}
|
||||
|
||||
// if file is encrypted return real file size
|
||||
if ($fileInfo && $fileInfo['encrypted'] === true) {
|
||||
if (isset($fileInfo['encrypted']) && $fileInfo['encrypted'] === true) {
|
||||
// try to fix unencrypted file size if it doesn't look plausible
|
||||
if ((int)$fileInfo['size'] > 0 && (int)$fileInfo['unencrypted_size'] === 0 ) {
|
||||
$fixSize = $util->getFileSize($path);
|
||||
|
|
Loading…
Reference in a new issue