Skip to content

Commit 2004ae4

Browse files
committed
Set delimiter so that the CommonPrefixes response can properly be determined
Signed-off-by: Julius Härtl <jus@bitgrid.net>
1 parent fc96fa0 commit 2004ae4

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

apps/files_external/lib/Lib/Storage/AmazonS3.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,9 @@ private function doesDirectoryExist($path) {
163163
'Bucket' => $this->bucket,
164164
'Prefix' => rtrim($path, '/'),
165165
'MaxKeys' => 1,
166+
'Delimiter' => '/',
166167
]);
167-
$this->directoryCache[$path] = $result['Contents'] || $result['CommonPrefixes'];
168+
$this->directoryCache[$path] = ($result['Contents'][0]['Key'] === rtrim($path, '/') . '/') || $result['CommonPrefixes'];
168169
} catch (S3Exception $e) {
169170
if ($e->getStatusCode() === 403) {
170171
$this->directoryCache[$path] = false;

0 commit comments

Comments
 (0)