Merge pull request #59828 from nextcloud/backport/59597/stable32

[stable32] fix(s3): ignore prefixes with repeating delimiters
This commit is contained in:
Kent Delante 2026-04-23 15:25:15 +08:00 committed by GitHub
commit 55e42231bf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -645,6 +645,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;