fix(s3): Fix 0 folder handling in External Storage

Signed-off-by: Josh <josh.t.richards@gmail.com>
This commit is contained in:
Josh 2026-02-27 10:34:04 -05:00 committed by backportbot[bot]
parent 62f4a7eb80
commit 9630fd0b60

View file

@ -32,26 +32,21 @@ class AmazonS3 extends Common {
private LoggerInterface $logger;
public function needsPartFile(): bool {
return false;
}
/** @var CappedMemoryCache<array|false> */
private CappedMemoryCache $objectCache;
/** @var CappedMemoryCache<bool> */
private CappedMemoryCache $directoryCache;
/** @var CappedMemoryCache<array> */
private CappedMemoryCache $filesCache;
private IMimeTypeDetector $mimeDetector;
private ?bool $versioningEnabled = null;
private ICache $memCache;
private ?bool $versioningEnabled = null;
public function __construct(array $parameters) {
parent::__construct($parameters);
$this->parseParams($parameters);
// @todo: using `key` here may be problematic with different authentication methods and/or key rotation...
$this->id = 'amazon::external::' . md5($this->params['hostname'] . ':' . $this->params['bucket'] . ':' . $this->params['key']);
$this->objectCache = new CappedMemoryCache();
$this->directoryCache = new CappedMemoryCache();
@ -66,7 +61,7 @@ class AmazonS3 extends Common {
private function normalizePath(string $path): string {
$path = trim($path, '/');
if (!$path) {
if ($path === '') {
$path = '.';
}
@ -742,6 +737,11 @@ class AmazonS3 extends Common {
}
}
public function needsPartFile(): bool {
// handled natively by the S3 backend/client integration
return false;
}
public function writeStream(string $path, $stream, ?int $size = null): int {
if ($size === null) {
$size = 0;