]> source.dussan.org Git - nextcloud-server.git/commitdiff
remove unneeded if 16632/head
authorRobin Appelman <robin@icewind.nl>
Fri, 28 Aug 2020 09:43:23 +0000 (11:43 +0200)
committerRobin Appelman <robin@icewind.nl>
Fri, 28 Aug 2020 09:43:23 +0000 (11:43 +0200)
Signed-off-by: Robin Appelman <robin@icewind.nl>
apps/files_sharing/lib/SharedStorage.php

index 7477e5601ff36411c49cd3e87e6fd38046016344..a90d347593f902ca5924b9e65ce9bedb2965822a 100644 (file)
@@ -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);
        }
 
        /**