aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_external/lib
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2020-09-09 14:29:11 +0200
committerJulius Härtl <jus@bitgrid.net>2020-09-10 08:11:55 +0200
commitfc96fa0cc7081307a8c03457a026fdc045d88f02 (patch)
treebb701d505fefdf7446fc6a07452fe0aee5cd290e /apps/files_external/lib
parent9780c4f755830efc1495a8c79b3dfaa098406452 (diff)
downloadnextcloud-server-fc96fa0cc7081307a8c03457a026fdc045d88f02.tar.gz
nextcloud-server-fc96fa0cc7081307a8c03457a026fdc045d88f02.zip
fix s3 doesDirectoryExist check for empty directories
if a directory is empty, only the 'marker' object `/` exists. since not all s3 implementations return just the prefix when listing objects by prefix, when listing objects by the folder prefix, nothing will be returned if the directory is empty. by not including the trailing slash in the prefix, the folder marked will always be returned if it exists Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'apps/files_external/lib')
-rw-r--r--apps/files_external/lib/Lib/Storage/AmazonS3.php2
1 files changed, 1 insertions, 1 deletions
diff --git a/apps/files_external/lib/Lib/Storage/AmazonS3.php b/apps/files_external/lib/Lib/Storage/AmazonS3.php
index 0b364204304..dc725188979 100644
--- a/apps/files_external/lib/Lib/Storage/AmazonS3.php
+++ b/apps/files_external/lib/Lib/Storage/AmazonS3.php
@@ -161,7 +161,7 @@ class AmazonS3 extends \OC\Files\Storage\Common {
try {
$result = $this->getConnection()->listObjects([
'Bucket' => $this->bucket,
- 'Prefix' => rtrim($path, '/') . '/',
+ 'Prefix' => rtrim($path, '/'),
'MaxKeys' => 1,
]);
$this->directoryCache[$path] = $result['Contents'] || $result['CommonPrefixes'];