mirror of
https://github.com/nextcloud/server.git
synced 2026-05-17 02:49:55 -04:00
fix(s3): ignore prefixes with repeating delimiters
Signed-off-by: Kent Delante <kent@delante.me> Amazon's hosted S3 service allows repeating delimiters in keys (e.g. 'path/to//file.txt' or 'path/to///file.txt') and we get repeating directories in the filecache as a result (based on the previous examples we get 'path/to/to/file.txt' or 'path/to/to/to/file.txt'). This ignores it and its contents for S3 external storage.
This commit is contained in:
parent
e511ce5041
commit
8d4fa6fa47
1 changed files with 6 additions and 0 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in a new issue