Merge pull request #59829 from nextcloud/backport/59597/stable33

[stable33] fix(s3): ignore prefixes with repeating delimiters
This commit is contained in:
Kent Delante 2026-05-13 13:49:44 +08:00 committed by GitHub
commit b5b6c87e17
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -646,6 +646,12 @@ class AmazonS3 extends Common {
// sub folders
if (is_array($result['CommonPrefixes'])) {
foreach ($result['CommonPrefixes'] as $prefix) {
if (preg_match('/\/{2,}$/', $prefix['Prefix'])) {
$this->logger->warning('Detected a repeating delimiter in prefix \'' . $prefix['Prefix']
. '\'. This is unsupported and its contents have been ignored.');
continue;
}
$dir = $this->getDirectoryMetaData($prefix['Prefix']);
if ($dir) {
yield $dir;