Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
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 <[email protected]>
  • Loading branch information
icewind1991 authored and backportbot[bot] committed Sep 10, 2020
commit 4163ee97ef66e357c5ff15ce1a680dffdbdd9340
2 changes: 1 addition & 1 deletion apps/files_external/lib/Lib/Storage/AmazonS3.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ private function doesDirectoryExist($path) {
try {
$result = $this->getConnection()->listObjects([
'Bucket' => $this->bucket,
'Prefix' => rtrim($path, '/') . '/',
'Prefix' => rtrim($path, '/'),
'MaxKeys' => 1,
]);
$this->directoryCache[$path] = $result['Contents'] || $result['CommonPrefixes'];
Expand Down