Don't try to encrypt a file when the temp file isn't created
This commit is contained in:
parent
6aa9daf4e6
commit
40f148cc6c
1 changed files with 21 additions and 18 deletions
|
@ -840,6 +840,7 @@ class Util {
|
|||
// Open enc file handle for binary writing, with same filename as original plain file
|
||||
$encHandle = fopen('crypt://' . $rawPath . '.part', 'wb');
|
||||
|
||||
if (is_resource($encHandle)) {
|
||||
// Move plain file to a temporary location
|
||||
$size = stream_copy_to_stream($plainHandle, $encHandle);
|
||||
|
||||
|
@ -854,18 +855,20 @@ class Util {
|
|||
// set timestamp
|
||||
$this->view->touch($relPath, $timestamp);
|
||||
|
||||
$encSize = $this->view->filesize($relPath);
|
||||
|
||||
$this->view->chroot($fakeRoot);
|
||||
|
||||
// Add the file to the cache
|
||||
\OC\Files\Filesystem::putFileInfo($relPath, array(
|
||||
'encrypted' => true,
|
||||
'size' => $size,
|
||||
'size' => $encSize,
|
||||
'unencrypted_size' => $size,
|
||||
'etag' => $fileInfo['etag']
|
||||
));
|
||||
|
||||
$encryptedFiles[] = $relPath;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// Encrypt legacy encrypted files
|
||||
|
|
Loading…
Reference in a new issue