summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2020-09-10 12:48:37 +0200
committerGitHub <noreply@github.com>2020-09-10 12:48:37 +0200
commit756254c36a3ed20bd330dabd1e0e7d2909b70758 (patch)
tree561e4a6782af12a9509f2262c7d7ca2997f244bb /apps
parenta45c4c350283d383191e4fc69b9cddcba8a43d1b (diff)
parent2004ae46030734080fa2fcf73ec54a3893333408 (diff)
downloadnextcloud-server-756254c36a3ed20bd330dabd1e0e7d2909b70758.tar.gz
nextcloud-server-756254c36a3ed20bd330dabd1e0e7d2909b70758.zip
Merge pull request #22747 from nextcloud/s3-isdir-empty
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 0b364204304..4510de8b6ec 100644
--- a/apps/files_external/lib/Lib/Storage/AmazonS3.php
+++ b/apps/files_external/lib/Lib/Storage/AmazonS3.php
@@ -161,10 +161,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;