]> source.dussan.org Git - nextcloud-server.git/commitdiff
Check previews in multibucket fallback folder as the last step and not as first step 22139/head
authorMorris Jobke <hey@morrisjobke.de>
Fri, 7 Aug 2020 07:32:31 +0000 (09:32 +0200)
committerMorris Jobke <hey@morrisjobke.de>
Fri, 7 Aug 2020 07:37:11 +0000 (09:37 +0200)
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
lib/private/Preview/Storage/Root.php

index a284b037b3558ff1d228c3822d3c3a39ee719597..a2efc8196a8482e29eb7ccb422a9a7518b1b6bba 100644 (file)
@@ -43,14 +43,6 @@ class Root extends AppData {
        public function getFolder(string $name): ISimpleFolder {
                $internalFolder = $this->getInternalFolder($name);
 
-               if ($this->isMultibucketPreviewDistributionEnabled) {
-                       try {
-                               return parent::getFolder('old-multibucket/' . $internalFolder);
-                       } catch (NotFoundException $e) {
-                               // not in multibucket fallback
-                       }
-               }
-
                try {
                        return parent::getFolder($internalFolder);
                } catch (NotFoundException $e) {
@@ -60,7 +52,20 @@ class Root extends AppData {
                         */
                }
 
-               return parent::getFolder($name);
+               try {
+                       return parent::getFolder($name);
+               } catch (NotFoundException $e) {
+                       /*
+                        * The old folder structure is not found.
+                        * Lets try the multibucket fallback if available
+                        */
+                       if ($this->isMultibucketPreviewDistributionEnabled) {
+                               return parent::getFolder('old-multibucket/' . $internalFolder);
+                       }
+
+                       // when there is no further fallback just throw the exception
+                       throw $e;
+               }
        }
 
        public function newFolder(string $name): ISimpleFolder {