diff options
author | Robin Appelman <robin@icewind.nl> | 2020-08-28 11:43:23 +0200 |
---|---|---|
committer | Robin Appelman <robin@icewind.nl> | 2020-08-28 11:43:23 +0200 |
commit | af381a9a934f349d72af6b712811f98292cc2c38 (patch) | |
tree | 5d5a10983bdcfebb0b723fcf26e6af45b995f105 /apps/files_sharing/lib | |
parent | 2879472f817031c811b33871309acd9b03458e16 (diff) | |
download | nextcloud-server-af381a9a934f349d72af6b712811f98292cc2c38.tar.gz nextcloud-server-af381a9a934f349d72af6b712811f98292cc2c38.zip |
remove unneeded if
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'apps/files_sharing/lib')
-rw-r--r-- | apps/files_sharing/lib/SharedStorage.php | 86 |
1 files changed, 42 insertions, 44 deletions
diff --git a/apps/files_sharing/lib/SharedStorage.php b/apps/files_sharing/lib/SharedStorage.php index 7477e5601ff..a90d347593f 100644 --- a/apps/files_sharing/lib/SharedStorage.php +++ b/apps/files_sharing/lib/SharedStorage.php @@ -244,57 +244,55 @@ class SharedStorage extends \OC\Files\Storage\Wrapper\Jail implements ISharedSto } public function fopen($path, $mode) { - if ($source = $this->getUnjailedPath($path)) { - switch ($mode) { - case 'r+': - case 'rb+': - case 'w+': - case 'wb+': - case 'x+': - case 'xb+': - case 'a+': - case 'ab+': - case 'w': - case 'wb': - case 'x': - case 'xb': - case 'a': - case 'ab': - $creatable = $this->isCreatable(dirname($path)); - $updatable = $this->isUpdatable($path); - // if neither permissions given, no need to continue - if (!$creatable && !$updatable) { - if (pathinfo($path, PATHINFO_EXTENSION) === 'part') { - $updatable = $this->isUpdatable(dirname($path)); - } - - if (!$updatable) { - return false; - } + $source = $this->getUnjailedPath($path); + switch ($mode) { + case 'r+': + case 'rb+': + case 'w+': + case 'wb+': + case 'x+': + case 'xb+': + case 'a+': + case 'ab+': + case 'w': + case 'wb': + case 'x': + case 'xb': + case 'a': + case 'ab': + $creatable = $this->isCreatable(dirname($path)); + $updatable = $this->isUpdatable($path); + // if neither permissions given, no need to continue + if (!$creatable && !$updatable) { + if (pathinfo($path, PATHINFO_EXTENSION) === 'part') { + $updatable = $this->isUpdatable(dirname($path)); } - $exists = $this->file_exists($path); - // if a file exists, updatable permissions are required - if ($exists && !$updatable) { + if (!$updatable) { return false; } + } - // part file is allowed if !$creatable but the final file is $updatable - if (pathinfo($path, PATHINFO_EXTENSION) !== 'part') { - if (!$exists && !$creatable) { - return false; - } + $exists = $this->file_exists($path); + // if a file exists, updatable permissions are required + if ($exists && !$updatable) { + return false; + } + + // part file is allowed if !$creatable but the final file is $updatable + if (pathinfo($path, PATHINFO_EXTENSION) !== 'part') { + if (!$exists && !$creatable) { + return false; } - } - $info = [ - 'target' => $this->getMountPoint() . $path, - 'source' => $source, - 'mode' => $mode, - ]; - \OCP\Util::emitHook('\OC\Files\Storage\Shared', 'fopen', $info); - return $this->nonMaskedStorage->fopen($this->getUnjailedPath($path), $mode); + } } - return false; + $info = [ + 'target' => $this->getMountPoint() . $path, + 'source' => $source, + 'mode' => $mode, + ]; + \OCP\Util::emitHook('\OC\Files\Storage\Shared', 'fopen', $info); + return $this->nonMaskedStorage->fopen($this->getUnjailedPath($path), $mode); } /** |