]> source.dussan.org Git - nextcloud-server.git/commitdiff
Set delimiter so that the CommonPrefixes response can properly be determined 22747/head
authorJulius Härtl <jus@bitgrid.net>
Wed, 9 Sep 2020 13:19:04 +0000 (15:19 +0200)
committerJulius Härtl <jus@bitgrid.net>
Thu, 10 Sep 2020 06:11:55 +0000 (08:11 +0200)
Signed-off-by: Julius Härtl <jus@bitgrid.net>
apps/files_external/lib/Lib/Storage/AmazonS3.php

index dc72518897989e1184eeb152b814120e8b27c1b4..4510de8b6ec2a48db4adcd9ca366dc9ebd01ba67 100644 (file)
@@ -163,8 +163,9 @@ class AmazonS3 extends \OC\Files\Storage\Common {
                                        'Bucket' => $this->bucket,
                                        'Prefix' => rtrim($path, '/'),
                                        'MaxKeys' => 1,
+                                       'Delimiter' => '/',
                                ]);
-                               $this->directoryCache[$path] = $result['Contents'] || $result['CommonPrefixes'];
+                               $this->directoryCache[$path] = ($result['Contents'][0]['Key'] === rtrim($path, '/') . '/') || $result['CommonPrefixes'];
                        } catch (S3Exception $e) {
                                if ($e->getStatusCode() === 403) {
                                        $this->directoryCache[$path] = false;