From 9d2494e5099f7565564491a5f9281aa22e8afb47 Mon Sep 17 00:00:00 2001 From: Josh Date: Fri, 27 Feb 2026 10:34:04 -0500 Subject: [PATCH] fix(s3): Fix `0` folder handling in External Storage Signed-off-by: Josh --- apps/files_external/lib/Lib/Storage/AmazonS3.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/apps/files_external/lib/Lib/Storage/AmazonS3.php b/apps/files_external/lib/Lib/Storage/AmazonS3.php index fd45e6c35df..801de49960a 100644 --- a/apps/files_external/lib/Lib/Storage/AmazonS3.php +++ b/apps/files_external/lib/Lib/Storage/AmazonS3.php @@ -31,26 +31,21 @@ class AmazonS3 extends Common { private LoggerInterface $logger; - public function needsPartFile(): bool { - return false; - } - /** @var CappedMemoryCache */ private CappedMemoryCache $objectCache; - /** @var CappedMemoryCache */ private CappedMemoryCache $directoryCache; - /** @var CappedMemoryCache */ 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(); @@ -65,7 +60,7 @@ class AmazonS3 extends Common { private function normalizePath(string $path): string { $path = trim($path, '/'); - if (!$path) { + if ($path === '') { $path = '.'; } @@ -741,6 +736,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;