diff options
author | John Molakvoæ <skjnldsv@users.noreply.github.com> | 2021-10-22 12:47:37 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-22 12:47:37 +0300 |
commit | e673ec0b879e4d32bb468825c549738e342df0f2 (patch) | |
tree | a7a01e82ac7b7aaddb07232a2d71aee85c17d8a9 /lib/private/Files/Storage | |
parent | 7995c6e1dce83becf1e948de960894d481775a6f (diff) | |
parent | 0a359376628b36256aa8332d79b1af1dfc513ce8 (diff) |
Merge branch 'master' into imountpoint-ocp-storage
Diffstat (limited to 'lib/private/Files/Storage')
20 files changed, 61 insertions, 330 deletions
diff --git a/lib/private/Files/Storage/Common.php b/lib/private/Files/Storage/Common.php index aa2aeee403b..4c07426dd70 100644 --- a/lib/private/Files/Storage/Common.php +++ b/lib/private/Files/Storage/Common.php @@ -9,6 +9,7 @@ * @author hkjolhede <hkjolhede@gmail.com> * @author Joas Schilling <coding@schilljs.com> * @author Jörn Friedrich Dreyer <jfd@butonic.de> + * @author Julius Härtl <jus@bitgrid.net> * @author Lukas Reschke <lukas@statuscode.ch> * @author Martin Mattel <martin.mattel@diemattels.at> * @author Michael Gapczynski <GapczynskiM@gmail.com> @@ -39,7 +40,6 @@ * along with this program. If not, see <http://www.gnu.org/licenses/> * */ - namespace OC\Files\Storage; use OC\Files\Cache\Cache; @@ -153,7 +153,7 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage { public function isDeletable($path) { if ($path === '' || $path === '/') { - return false; + return $this->isUpdatable($path); } $parent = dirname($path); return $this->isUpdatable($parent) && $this->isUpdatable($path); @@ -316,12 +316,12 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage { } /** - * check if a file or folder has been updated since $time + * Check if a file or folder has been updated since $time * * The method is only used to check if the cache needs to be updated. Storage backends that don't support checking * the mtime should always return false here. As a result storage implementations that always return false expect * exclusive access to the backend and will not pick up files that have been added in a way that circumvents - * ownClouds filesystem. + * Nextcloud filesystem. * * @param string $path * @param int $time @@ -612,6 +612,7 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage { $dh = $sourceStorage->opendir($sourceInternalPath); $result = $this->mkdir($targetInternalPath); if (is_resource($dh)) { + $result = true; while ($result and ($file = readdir($dh)) !== false) { if (!Filesystem::isIgnoredDir($file)) { $result &= $this->copyFromStorage($sourceStorage, $sourceInternalPath . '/' . $file, $targetInternalPath . '/' . $file); diff --git a/lib/private/Files/Storage/CommonTest.php b/lib/private/Files/Storage/CommonTest.php index 43a87f8d704..3800bba2b52 100644 --- a/lib/private/Files/Storage/CommonTest.php +++ b/lib/private/Files/Storage/CommonTest.php @@ -26,11 +26,6 @@ * along with this program. If not, see <http://www.gnu.org/licenses/> * */ - -/** - * test implementation for \OC\Files\Storage\Common with \OC\Files\Storage\Local - */ - namespace OC\Files\Storage; class CommonTest extends \OC\Files\Storage\Common { diff --git a/lib/private/Files/Storage/DAV.php b/lib/private/Files/Storage/DAV.php index 8f09452e1fb..161f346e52f 100644 --- a/lib/private/Files/Storage/DAV.php +++ b/lib/private/Files/Storage/DAV.php @@ -35,7 +35,6 @@ * along with this program. If not, see <http://www.gnu.org/licenses/> * */ - namespace OC\Files\Storage; use Exception; diff --git a/lib/private/Files/Storage/FailedStorage.php b/lib/private/Files/Storage/FailedStorage.php index bb97fe73875..18a2c9c2bb5 100644 --- a/lib/private/Files/Storage/FailedStorage.php +++ b/lib/private/Files/Storage/FailedStorage.php @@ -23,7 +23,6 @@ * along with this program. If not, see <http://www.gnu.org/licenses/> * */ - namespace OC\Files\Storage; use OC\Files\Cache\FailedCache; diff --git a/lib/private/Files/Storage/Flysystem.php b/lib/private/Files/Storage/Flysystem.php deleted file mode 100644 index c5105187652..00000000000 --- a/lib/private/Files/Storage/Flysystem.php +++ /dev/null @@ -1,265 +0,0 @@ -<?php -/** - * @copyright Copyright (c) 2016, ownCloud, Inc. - * - * @author Christoph Wurst <christoph@winzerhof-wurst.at> - * @author Robin Appelman <robin@icewind.nl> - * @author Roeland Jago Douma <roeland@famdouma.nl> - * @author Tigran Mkrtchyan <tigran.mkrtchyan@desy.de> - * - * @license AGPL-3.0 - * - * This code is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License, version 3, - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License, version 3, - * along with this program. If not, see <http://www.gnu.org/licenses/> - * - */ - -namespace OC\Files\Storage; - -use Icewind\Streams\CallbackWrapper; -use Icewind\Streams\IteratorDirectory; -use League\Flysystem\AdapterInterface; -use League\Flysystem\FileNotFoundException; -use League\Flysystem\Filesystem; -use League\Flysystem\Plugin\GetWithMetadata; - -/** - * Generic adapter between flysystem adapters and owncloud's storage system - * - * To use: subclass and call $this->buildFlysystem with the flysystem adapter of choice - */ -abstract class Flysystem extends Common { - /** - * @var Filesystem - */ - protected $flysystem; - - /** - * @var string - */ - protected $root = ''; - - /** - * Initialize the storage backend with a flyssytem adapter - * - * @param \League\Flysystem\AdapterInterface $adapter - */ - protected function buildFlySystem(AdapterInterface $adapter) { - $this->flysystem = new Filesystem($adapter); - $this->flysystem->addPlugin(new GetWithMetadata()); - } - - protected function buildPath($path) { - $fullPath = \OC\Files\Filesystem::normalizePath($this->root . '/' . $path); - return ltrim($fullPath, '/'); - } - - /** - * {@inheritdoc} - */ - public function file_get_contents($path) { - return $this->flysystem->read($this->buildPath($path)); - } - - /** - * {@inheritdoc} - */ - public function file_put_contents($path, $data) { - $result = $this->flysystem->put($this->buildPath($path), $data); - if ($result === true) { - return strlen($data); - } - return $result; - } - - /** - * {@inheritdoc} - */ - public function file_exists($path) { - return $this->flysystem->has($this->buildPath($path)); - } - - /** - * {@inheritdoc} - */ - public function unlink($path) { - if ($this->is_dir($path)) { - return $this->rmdir($path); - } - try { - return $this->flysystem->delete($this->buildPath($path)); - } catch (FileNotFoundException $e) { - return false; - } - } - - /** - * {@inheritdoc} - */ - public function rename($source, $target) { - if ($this->file_exists($target)) { - $this->unlink($target); - } - return $this->flysystem->rename($this->buildPath($source), $this->buildPath($target)); - } - - /** - * {@inheritdoc} - */ - public function copy($source, $target) { - if ($this->file_exists($target)) { - $this->unlink($target); - } - return $this->flysystem->copy($this->buildPath($source), $this->buildPath($target)); - } - - /** - * {@inheritdoc} - */ - public function filesize($path) { - if ($this->is_dir($path)) { - return 0; - } else { - return $this->flysystem->getSize($this->buildPath($path)); - } - } - - /** - * {@inheritdoc} - */ - public function mkdir($path) { - if ($this->file_exists($path)) { - return false; - } - return $this->flysystem->createDir($this->buildPath($path)); - } - - /** - * {@inheritdoc} - */ - public function filemtime($path) { - return $this->flysystem->getTimestamp($this->buildPath($path)); - } - - /** - * {@inheritdoc} - */ - public function rmdir($path) { - try { - return @$this->flysystem->deleteDir($this->buildPath($path)); - } catch (FileNotFoundException $e) { - return false; - } - } - - /** - * {@inheritdoc} - */ - public function opendir($path) { - try { - $content = $this->flysystem->listContents($this->buildPath($path)); - } catch (FileNotFoundException $e) { - return false; - } - $names = array_map(function ($object) { - return $object['basename']; - }, $content); - return IteratorDirectory::wrap($names); - } - - /** - * {@inheritdoc} - */ - public function fopen($path, $mode) { - $fullPath = $this->buildPath($path); - $useExisting = true; - switch ($mode) { - case 'r': - case 'rb': - try { - return $this->flysystem->readStream($fullPath); - } catch (FileNotFoundException $e) { - return false; - } - case 'w': - case 'w+': - case 'wb': - case 'wb+': - $useExisting = false; - // no break - case 'a': - case 'ab': - case 'r+': - case 'a+': - case 'x': - case 'x+': - case 'c': - case 'c+': - //emulate these - if ($useExisting and $this->file_exists($path)) { - if (!$this->isUpdatable($path)) { - return false; - } - $tmpFile = $this->getCachedFile($path); - } else { - if (!$this->isCreatable(dirname($path))) { - return false; - } - $tmpFile = \OC::$server->getTempManager()->getTemporaryFile(); - } - $source = fopen($tmpFile, $mode); - return CallbackWrapper::wrap($source, null, null, function () use ($tmpFile, $fullPath) { - $this->flysystem->putStream($fullPath, fopen($tmpFile, 'r')); - unlink($tmpFile); - }); - } - return false; - } - - /** - * {@inheritdoc} - */ - public function touch($path, $mtime = null) { - if ($this->file_exists($path)) { - return false; - } else { - $this->file_put_contents($path, ''); - return true; - } - } - - /** - * {@inheritdoc} - */ - public function stat($path) { - $info = $this->flysystem->getWithMetadata($this->buildPath($path), ['timestamp', 'size']); - return [ - 'mtime' => $info['timestamp'], - 'size' => $info['size'] - ]; - } - - /** - * {@inheritdoc} - */ - public function filetype($path) { - if ($path === '' or $path === '/' or $path === '.') { - return 'dir'; - } - try { - $info = $this->flysystem->getMetadata($this->buildPath($path)); - } catch (FileNotFoundException $e) { - return false; - } - return $info['type']; - } -} diff --git a/lib/private/Files/Storage/Home.php b/lib/private/Files/Storage/Home.php index 5c35c93bfc8..5427bc425c2 100644 --- a/lib/private/Files/Storage/Home.php +++ b/lib/private/Files/Storage/Home.php @@ -23,7 +23,6 @@ * along with this program. If not, see <http://www.gnu.org/licenses/> * */ - namespace OC\Files\Storage; use OC\Files\Cache\HomePropagator; diff --git a/lib/private/Files/Storage/Local.php b/lib/private/Files/Storage/Local.php index 944b0b69959..13f1a6f2ec4 100644 --- a/lib/private/Files/Storage/Local.php +++ b/lib/private/Files/Storage/Local.php @@ -11,6 +11,7 @@ * @author J0WI <J0WI@users.noreply.github.com> * @author Jakob Sack <mail@jakobsack.de> * @author Joas Schilling <coding@schilljs.com> + * @author Johannes Leuker <j.leuker@hosting.de> * @author Jörn Friedrich Dreyer <jfd@butonic.de> * @author Klaas Freitag <freitag@owncloud.com> * @author Lukas Reschke <lukas@statuscode.ch> @@ -39,7 +40,6 @@ * along with this program. If not, see <http://www.gnu.org/licenses/> * */ - namespace OC\Files\Storage; use OC\Files\Filesystem; @@ -87,8 +87,9 @@ class Local extends \OC\Files\Storage\Common { public function mkdir($path) { $sourcePath = $this->getSourcePath($path); + $oldMask = umask(022); $result = @mkdir($sourcePath, 0777, true); - chmod($sourcePath, 0755); + umask($oldMask); return $result; } @@ -168,7 +169,7 @@ class Local extends \OC\Files\Storage\Common { $permissions = Constants::PERMISSION_SHARE; $statPermissions = $stat['mode']; - $isDir = ($statPermissions & 0x4000) === 0x4000; + $isDir = ($statPermissions & 0x4000) === 0x4000 && !($statPermissions & 0x8000); if ($statPermissions & 0x0100) { $permissions += Constants::PERMISSION_READ; } @@ -215,7 +216,7 @@ class Local extends \OC\Files\Storage\Common { } public function filesize($path) { - if ($this->is_dir($path)) { + if (!$this->is_file($path)) { return 0; } $fullPath = $this->getSourcePath($path); @@ -258,11 +259,13 @@ class Local extends \OC\Files\Storage\Common { if ($this->file_exists($path) and !$this->isUpdatable($path)) { return false; } + $oldMask = umask(022); if (!is_null($mtime)) { $result = @touch($this->getSourcePath($path), $mtime); } else { $result = @touch($this->getSourcePath($path)); } + umask($oldMask); if ($result) { clearstatcache(true, $this->getSourcePath($path)); } @@ -275,7 +278,10 @@ class Local extends \OC\Files\Storage\Common { } public function file_put_contents($path, $data) { - return file_put_contents($this->getSourcePath($path), $data); + $oldMask = umask(022); + $result = file_put_contents($this->getSourcePath($path), $data); + umask($oldMask); + return $result; } public function unlink($path) { @@ -288,16 +294,14 @@ class Local extends \OC\Files\Storage\Common { } } - private function treeContainsBlacklistedFile(string $path): bool { + private function checkTreeForForbiddenItems(string $path) { $iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($path)); foreach ($iterator as $file) { /** @var \SplFileInfo $file */ if (Filesystem::isFileBlacklisted($file->getBasename())) { - return true; + throw new ForbiddenException('Invalid path: ' . $file->getPathname(), false); } } - - return false; } public function rename($path1, $path2) { @@ -337,9 +341,7 @@ class Local extends \OC\Files\Storage\Common { return $result; } - if ($this->treeContainsBlacklistedFile($this->getSourcePath($path1))) { - throw new ForbiddenException('Invalid path', false); - } + $this->checkTreeForForbiddenItems($this->getSourcePath($path1)); } return rename($this->getSourcePath($path1), $this->getSourcePath($path2)); @@ -349,12 +351,18 @@ class Local extends \OC\Files\Storage\Common { if ($this->is_dir($path1)) { return parent::copy($path1, $path2); } else { - return copy($this->getSourcePath($path1), $this->getSourcePath($path2)); + $oldMask = umask(022); + $result = copy($this->getSourcePath($path1), $this->getSourcePath($path2)); + umask($oldMask); + return $result; } } public function fopen($path, $mode) { - return fopen($this->getSourcePath($path), $mode); + $oldMask = umask(022); + $result = fopen($this->getSourcePath($path), $mode); + umask($oldMask); + return $result; } public function hash($type, $path, $raw = false) { @@ -437,7 +445,7 @@ class Local extends \OC\Files\Storage\Common { */ public function getSourcePath($path) { if (Filesystem::isFileBlacklisted($path)) { - throw new ForbiddenException('Invalid path', false); + throw new ForbiddenException('Invalid path: ' . $path, false); } $fullPath = $this->datadir . $path; @@ -484,7 +492,7 @@ class Local extends \OC\Files\Storage\Common { } private function calculateEtag(string $path, array $stat): string { - if ($stat['mode'] & 0x4000) { // is_dir + if ($stat['mode'] & 0x4000 && !($stat['mode'] & 0x8000)) { // is_dir & not socket return parent::getETag($path); } else { if ($stat === false) { @@ -517,7 +525,10 @@ class Local extends \OC\Files\Storage\Common { * @return bool */ public function copyFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath, $preserveMtime = false) { - if ($sourceStorage->instanceOfStorage(Local::class)) { + // Don't treat ACLStorageWrapper like local storage where copy can be done directly. + // Instead use the slower recursive copying in php from Common::copyFromStorage with + // more permissions checks. + if ($sourceStorage->instanceOfStorage(Local::class) && !$sourceStorage->instanceOfStorage('OCA\GroupFolders\ACL\ACLStorageWrapper')) { if ($sourceStorage->instanceOfStorage(Jail::class)) { /** * @var \OC\Files\Storage\Wrapper\Jail $sourceStorage @@ -560,8 +571,11 @@ class Local extends \OC\Files\Storage\Common { public function writeStream(string $path, $stream, int $size = null): int { $result = $this->file_put_contents($path, $stream); + if (is_resource($stream)) { + fclose($stream); + } if ($result === false) { - throw new GenericFileException("Failed write steam to $path"); + throw new GenericFileException("Failed write stream to $path"); } else { return $result; } diff --git a/lib/private/Files/Storage/LocalRootStorage.php b/lib/private/Files/Storage/LocalRootStorage.php index 6f954212484..71584afef08 100644 --- a/lib/private/Files/Storage/LocalRootStorage.php +++ b/lib/private/Files/Storage/LocalRootStorage.php @@ -16,14 +16,13 @@ declare(strict_types=1); * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * */ - namespace OC\Files\Storage; use OC\Files\Cache\LocalRootScanner; diff --git a/lib/private/Files/Storage/LocalTempFileTrait.php b/lib/private/Files/Storage/LocalTempFileTrait.php index 0a3785d92dd..2a1338148f5 100644 --- a/lib/private/Files/Storage/LocalTempFileTrait.php +++ b/lib/private/Files/Storage/LocalTempFileTrait.php @@ -21,7 +21,6 @@ * along with this program. If not, see <http://www.gnu.org/licenses/> * */ - namespace OC\Files\Storage; /** diff --git a/lib/private/Files/Storage/PolyFill/CopyDirectory.php b/lib/private/Files/Storage/PolyFill/CopyDirectory.php index 6a12089c70a..7fd418f6dca 100644 --- a/lib/private/Files/Storage/PolyFill/CopyDirectory.php +++ b/lib/private/Files/Storage/PolyFill/CopyDirectory.php @@ -21,7 +21,6 @@ * along with this program. If not, see <http://www.gnu.org/licenses/> * */ - namespace OC\Files\Storage\PolyFill; trait CopyDirectory { @@ -65,15 +64,15 @@ trait CopyDirectory { */ abstract public function mkdir($path); - public function copy($source, $target) { - if ($this->is_dir($source)) { - if ($this->file_exists($target)) { - $this->unlink($target); + public function copy($path1, $path2) { + if ($this->is_dir($path1)) { + if ($this->file_exists($path2)) { + $this->unlink($path2); } - $this->mkdir($target); - return $this->copyRecursive($source, $target); + $this->mkdir($path2); + return $this->copyRecursive($path1, $path2); } else { - return parent::copy($source, $target); + return parent::copy($path1, $path2); } } diff --git a/lib/private/Files/Storage/Storage.php b/lib/private/Files/Storage/Storage.php index 94f1ee62430..cc317de2669 100644 --- a/lib/private/Files/Storage/Storage.php +++ b/lib/private/Files/Storage/Storage.php @@ -22,7 +22,6 @@ * along with this program. If not, see <http://www.gnu.org/licenses/> * */ - namespace OC\Files\Storage; use OCP\Lock\ILockingProvider; diff --git a/lib/private/Files/Storage/StorageFactory.php b/lib/private/Files/Storage/StorageFactory.php index 2e7dd732edd..cab739c4a81 100644 --- a/lib/private/Files/Storage/StorageFactory.php +++ b/lib/private/Files/Storage/StorageFactory.php @@ -22,7 +22,6 @@ * along with this program. If not, see <http://www.gnu.org/licenses/> * */ - namespace OC\Files\Storage; use OCP\Files\Mount\IMountPoint; diff --git a/lib/private/Files/Storage/Temporary.php b/lib/private/Files/Storage/Temporary.php index 686600e5d21..393a37f834a 100644 --- a/lib/private/Files/Storage/Temporary.php +++ b/lib/private/Files/Storage/Temporary.php @@ -23,7 +23,6 @@ * along with this program. If not, see <http://www.gnu.org/licenses/> * */ - namespace OC\Files\Storage; /** diff --git a/lib/private/Files/Storage/Wrapper/Availability.php b/lib/private/Files/Storage/Wrapper/Availability.php index 61814a0d087..b6d1ba2178b 100644 --- a/lib/private/Files/Storage/Wrapper/Availability.php +++ b/lib/private/Files/Storage/Wrapper/Availability.php @@ -24,7 +24,6 @@ * along with this program. If not, see <http://www.gnu.org/licenses/> * */ - namespace OC\Files\Storage\Wrapper; use OCP\Files\Storage\IStorage; diff --git a/lib/private/Files/Storage/Wrapper/Encoding.php b/lib/private/Files/Storage/Wrapper/Encoding.php index e2b486546af..ac27697e68c 100644 --- a/lib/private/Files/Storage/Wrapper/Encoding.php +++ b/lib/private/Files/Storage/Wrapper/Encoding.php @@ -5,6 +5,7 @@ * @author Christoph Wurst <christoph@winzerhof-wurst.at> * @author J0WI <J0WI@users.noreply.github.com> * @author Lukas Reschke <lukas@statuscode.ch> + * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <robin@icewind.nl> * @author Roeland Jago Douma <roeland@famdouma.nl> * @author Tigran Mkrtchyan <tigran.mkrtchyan@desy.de> @@ -25,7 +26,6 @@ * along with this program. If not, see <http://www.gnu.org/licenses/> * */ - namespace OC\Files\Storage\Wrapper; use OC\Cache\CappedMemoryCache; diff --git a/lib/private/Files/Storage/Wrapper/Encryption.php b/lib/private/Files/Storage/Wrapper/Encryption.php index a7a915afad9..e44b7afe6fd 100644 --- a/lib/private/Files/Storage/Wrapper/Encryption.php +++ b/lib/private/Files/Storage/Wrapper/Encryption.php @@ -7,6 +7,7 @@ * @author Björn Schießle <bjoern@schiessle.org> * @author Christoph Wurst <christoph@winzerhof-wurst.at> * @author J0WI <J0WI@users.noreply.github.com> + * @author jknockaert <jasper@knockaert.nl> * @author Joas Schilling <coding@schilljs.com> * @author Lukas Reschke <lukas@statuscode.ch> * @author Morris Jobke <hey@morrisjobke.de> @@ -32,7 +33,6 @@ * along with this program. If not, see <http://www.gnu.org/licenses/> * */ - namespace OC\Files\Storage\Wrapper; use OC\Encryption\Exceptions\ModuleDoesNotExistsException; @@ -925,21 +925,20 @@ class Encryption extends Wrapper { $path = $realFile; } - $firstBlock = $this->readFirstBlock($path); - $result = $this->parseRawHeader($firstBlock); + $result = []; - // if the header doesn't contain a encryption module we check if it is a - // legacy file. If true, we add the default encryption module - if (!isset($result[Util::HEADER_ENCRYPTION_MODULE_KEY])) { - if (!empty($result)) { + // first check if it is an encrypted file at all + // We would do query to filecache only if we know that entry in filecache exists + + $info = $this->getCache()->get($path); + if (isset($info['encrypted']) && $info['encrypted'] === true) { + $firstBlock = $this->readFirstBlock($path); + $result = $this->parseRawHeader($firstBlock); + + // if the header doesn't contain a encryption module we check if it is a + // legacy file. If true, we add the default encryption module + if (!isset($result[Util::HEADER_ENCRYPTION_MODULE_KEY]) && (!empty($result) || $exists)) { $result[Util::HEADER_ENCRYPTION_MODULE_KEY] = 'OC_DEFAULT_MODULE'; - } elseif ($exists) { - // if the header was empty we have to check first if it is a encrypted file at all - // We would do query to filecache only if we know that entry in filecache exists - $info = $this->getCache()->get($path); - if (isset($info['encrypted']) && $info['encrypted'] === true) { - $result[Util::HEADER_ENCRYPTION_MODULE_KEY] = 'OC_DEFAULT_MODULE'; - } } } @@ -1034,6 +1033,7 @@ class Encryption extends Wrapper { // always fall back to fopen $target = $this->fopen($path, 'w'); [$count, $result] = \OC_Helper::streamCopy($stream, $target); + fclose($stream); fclose($target); return $count; } diff --git a/lib/private/Files/Storage/Wrapper/Jail.php b/lib/private/Files/Storage/Wrapper/Jail.php index aa6cbf7e40c..65ee6f1181a 100644 --- a/lib/private/Files/Storage/Wrapper/Jail.php +++ b/lib/private/Files/Storage/Wrapper/Jail.php @@ -26,7 +26,6 @@ * along with this program. If not, see <http://www.gnu.org/licenses/> * */ - namespace OC\Files\Storage\Wrapper; use OC\Files\Cache\Wrapper\CacheJail; diff --git a/lib/private/Files/Storage/Wrapper/PermissionsMask.php b/lib/private/Files/Storage/Wrapper/PermissionsMask.php index 9c2d123b7bf..e54d3bb721a 100644 --- a/lib/private/Files/Storage/Wrapper/PermissionsMask.php +++ b/lib/private/Files/Storage/Wrapper/PermissionsMask.php @@ -25,7 +25,6 @@ * along with this program. If not, see <http://www.gnu.org/licenses/> * */ - namespace OC\Files\Storage\Wrapper; use OC\Files\Cache\Wrapper\CachePermissionsMask; diff --git a/lib/private/Files/Storage/Wrapper/Quota.php b/lib/private/Files/Storage/Wrapper/Quota.php index d631dae7747..4cd0a5e0b4a 100644 --- a/lib/private/Files/Storage/Wrapper/Quota.php +++ b/lib/private/Files/Storage/Wrapper/Quota.php @@ -4,7 +4,7 @@ * * @author Christoph Wurst <christoph@winzerhof-wurst.at> * @author J0WI <J0WI@users.noreply.github.com> - * @author John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> + * @author John Molakvoæ <skjnldsv@protonmail.com> * @author Jörn Friedrich Dreyer <jfd@butonic.de> * @author Julius Härtl <jus@bitgrid.net> * @author Lukas Reschke <lukas@statuscode.ch> @@ -30,7 +30,6 @@ * along with this program. If not, see <http://www.gnu.org/licenses/> * */ - namespace OC\Files\Storage\Wrapper; use OC\Files\Filesystem; diff --git a/lib/private/Files/Storage/Wrapper/Wrapper.php b/lib/private/Files/Storage/Wrapper/Wrapper.php index d45d5e9f9f0..5faffece67e 100644 --- a/lib/private/Files/Storage/Wrapper/Wrapper.php +++ b/lib/private/Files/Storage/Wrapper/Wrapper.php @@ -29,7 +29,6 @@ * along with this program. If not, see <http://www.gnu.org/licenses/> * */ - namespace OC\Files\Storage\Wrapper; use OCP\Files\InvalidPathException; |