Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@users.noreply.github.com>2020-09-11 09:45:06 +0300
committerGitHub <noreply@github.com>2020-09-11 09:45:06 +0300
commitb9ef2a543f442988b53bac54f82192b7e04860da (patch)
tree0fb94ddfd914f44fd380b740ea1e4e5393a2e258 /apps
parentcd29f22ee7d292a2e448a59d48f77f88d33192ff (diff)
parentb946d2c444ac809fc6b3b2357f2983a5a34ef5d9 (diff)
Merge pull request #22776 from nextcloud/backport/22747/stable19
[stable19] fix s3 doesDirectoryExist check for empty directories
Diffstat (limited to 'apps')
-rw-r--r--apps/files_external/lib/Lib/Storage/AmazonS3.php5
1 files changed, 3 insertions, 2 deletions
diff --git a/apps/files_external/lib/Lib/Storage/AmazonS3.php b/apps/files_external/lib/Lib/Storage/AmazonS3.php
index 23f6592581f..b4559943594 100644
--- a/apps/files_external/lib/Lib/Storage/AmazonS3.php
+++ b/apps/files_external/lib/Lib/Storage/AmazonS3.php
@@ -160,10 +160,11 @@ class AmazonS3 extends \OC\Files\Storage\Common {
try {
$result = $this->getConnection()->listObjects([
'Bucket' => $this->bucket,
- 'Prefix' => rtrim($path, '/') . '/',
+ '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;