]> source.dussan.org Git - nextcloud-server.git/commitdiff
doesDirectoryExist fixes
authorRobin Appelman <robin@icewind.nl>
Thu, 14 Oct 2021 16:36:55 +0000 (18:36 +0200)
committerRobin Appelman <robin@icewind.nl>
Tue, 26 Oct 2021 12:41:54 +0000 (14:41 +0200)
Signed-off-by: Robin Appelman <robin@icewind.nl>
apps/files_external/lib/Lib/Storage/AmazonS3.php

index b91f27097f45f4c3bbd69ac91bb90d845be22918..a6d5cb08c9f91b06b0ec7b6ae5ea9338b05ec9a7 100644 (file)
@@ -47,7 +47,6 @@ use Icewind\Streams\CallbackWrapper;
 use Icewind\Streams\IteratorDirectory;
 use OC\Cache\CappedMemoryCache;
 use OC\Files\Cache\CacheEntry;
-use OC\Files\Filesystem;
 use OC\Files\ObjectStore\S3ConnectionTrait;
 use OC\Files\ObjectStore\S3ObjectTrait;
 use OCP\Constants;
@@ -173,6 +172,7 @@ class AmazonS3 extends \OC\Files\Storage\Common {
                if ($path === '.' || $path === '') {
                        return true;
                }
+               $path = rtrim($path, '/') . '/';
 
                if (isset($this->directoryCache[$path])) {
                        return $this->directoryCache[$path];
@@ -182,7 +182,7 @@ class AmazonS3 extends \OC\Files\Storage\Common {
                        // Do a prefix listing of objects to determine.
                        $result = $this->getConnection()->listObjectsV2([
                                'Bucket' => $this->bucket,
-                               'Prefix' => rtrim($path, '/'),
+                               'Prefix' => $path,
                                'MaxKeys' => 1,
                        ]);
 
@@ -359,7 +359,7 @@ class AmazonS3 extends \OC\Files\Storage\Common {
                        return IteratorDirectory::wrap(array_map(function (array $item) {
                                return $item['name'];
                        }, $content));
-               }  catch (S3Exception $e) {
+               } catch (S3Exception $e) {
                        return false;
                }
        }
@@ -434,7 +434,7 @@ class AmazonS3 extends \OC\Files\Storage\Common {
                }
 
                try {
-                       return $this->isRoot($path) || $this->doesDirectoryExist($path);
+                       return $this->doesDirectoryExist($path);
                } catch (S3Exception $e) {
                        \OC::$server->getLogger()->logException($e, ['app' => 'files_external']);
                        return false;