From 958e67687b232398cc5c03b89e3f51334f4725ba Mon Sep 17 00:00:00 2001 From: Josh Date: Fri, 27 Feb 2026 10:34:04 -0500 Subject: [PATCH 1/6] 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 55ba926a1dd9a..fdcbf33627e17 100644 --- a/apps/files_external/lib/Lib/Storage/AmazonS3.php +++ b/apps/files_external/lib/Lib/Storage/AmazonS3.php @@ -32,26 +32,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->initCaches(); $this->mimeDetector = Server::get(IMimeTypeDetector::class); @@ -64,7 +59,7 @@ public function __construct(array $parameters) { private function normalizePath(string $path): string { $path = trim($path, '/'); - if (!$path) { + if ($path === '') { $path = '.'; } @@ -704,6 +699,11 @@ public function hasUpdated(string $path, int $time): bool { } } + 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; From 9ce1ae8e61f0428498ca3562c678ef0e860a9a04 Mon Sep 17 00:00:00 2001 From: Josh Date: Fri, 27 Feb 2026 10:40:10 -0500 Subject: [PATCH 2/6] fix(ObjectStorage): fix `0` folder handling in Primary Storage Signed-off-by: Josh --- lib/private/Files/ObjectStore/ObjectStoreStorage.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/private/Files/ObjectStore/ObjectStoreStorage.php b/lib/private/Files/ObjectStore/ObjectStoreStorage.php index a28475e0e4b1a..4555e13863dd5 100644 --- a/lib/private/Files/ObjectStore/ObjectStoreStorage.php +++ b/lib/private/Files/ObjectStore/ObjectStoreStorage.php @@ -130,7 +130,7 @@ private function normalizePath(string $path): string { $path = str_replace('//', '/', $path); // dirname('/folder') returns '.' but internally (in the cache) we store the root as '' - if (!$path || $path === '.') { + if ($path === '.') { $path = ''; } From ace9eb21e6ad6450154854a9bc867fdef97ac0fb Mon Sep 17 00:00:00 2001 From: Josh Date: Fri, 27 Feb 2026 12:44:36 -0500 Subject: [PATCH 3/6] test(Storage): expand file / directory name tests Signed-off-by: Josh --- tests/lib/Files/Storage/Storage.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/lib/Files/Storage/Storage.php b/tests/lib/Files/Storage/Storage.php index 9107d99cd6738..1fa2575f1f149 100644 --- a/tests/lib/Files/Storage/Storage.php +++ b/tests/lib/Files/Storage/Storage.php @@ -116,6 +116,10 @@ public static function fileNameProvider(): array { ['file with space.txt'], ['spéciäl fäile'], ['test single\'quote.txt'], + ['0'], + ['#'], + ['%'], + ['%20'], ]; } @@ -127,6 +131,10 @@ public static function directoryProvider(): array { ['folder with space'], ['spéciäl földer'], ['test single\'quote'], + ['0'], + ['#'], + ['%'], + ['%20'], ]; } From d5d34adcbb68070b6151baf329eb25f2c8508218 Mon Sep 17 00:00:00 2001 From: Josh Date: Fri, 27 Feb 2026 13:00:07 -0500 Subject: [PATCH 4/6] fix(S3ObjectTrait): cast $urn to a string until typing adding elsewhere Signed-off-by: Josh --- lib/private/Files/ObjectStore/S3ObjectTrait.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/private/Files/ObjectStore/S3ObjectTrait.php b/lib/private/Files/ObjectStore/S3ObjectTrait.php index 384e9f0ff58c9..a5638a2e3ab02 100644 --- a/lib/private/Files/ObjectStore/S3ObjectTrait.php +++ b/lib/private/Files/ObjectStore/S3ObjectTrait.php @@ -150,7 +150,7 @@ protected function writeMultiPart(string $urn, StreamInterface $stream, array $m $uploader = new MultipartUploader($this->getConnection(), $stream, [ 'bucket' => $this->bucket, 'concurrency' => $concurrency, - 'key' => $urn, + 'key' => (string) $urn, 'part_size' => $this->uploadPartSize, 'state' => $state, 'params' => [ From 6c1d648f5942c90d1f129d9e55d8f9d7dd3872d7 Mon Sep 17 00:00:00 2001 From: Josh Date: Sat, 28 Feb 2026 07:44:23 -0500 Subject: [PATCH 5/6] chore: fixup/ revert cast in S3ObjectTrait Signed-off-by: Josh --- lib/private/Files/ObjectStore/S3ObjectTrait.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/private/Files/ObjectStore/S3ObjectTrait.php b/lib/private/Files/ObjectStore/S3ObjectTrait.php index a5638a2e3ab02..384e9f0ff58c9 100644 --- a/lib/private/Files/ObjectStore/S3ObjectTrait.php +++ b/lib/private/Files/ObjectStore/S3ObjectTrait.php @@ -150,7 +150,7 @@ protected function writeMultiPart(string $urn, StreamInterface $stream, array $m $uploader = new MultipartUploader($this->getConnection(), $stream, [ 'bucket' => $this->bucket, 'concurrency' => $concurrency, - 'key' => (string) $urn, + 'key' => $urn, 'part_size' => $this->uploadPartSize, 'state' => $state, 'params' => [ From 2d39c5a179583e4a4d61130a785812129527f1af Mon Sep 17 00:00:00 2001 From: Josh Date: Sat, 28 Feb 2026 07:53:16 -0500 Subject: [PATCH 6/6] test(Storage): avoid falsy directory/filename checks (for now) Signed-off-by: Josh --- tests/lib/Files/Storage/Storage.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/lib/Files/Storage/Storage.php b/tests/lib/Files/Storage/Storage.php index 1fa2575f1f149..091f8b69a6e2e 100644 --- a/tests/lib/Files/Storage/Storage.php +++ b/tests/lib/Files/Storage/Storage.php @@ -116,7 +116,7 @@ public static function fileNameProvider(): array { ['file with space.txt'], ['spéciäl fäile'], ['test single\'quote.txt'], - ['0'], + /*['0'],*/ // disabled until upstream aws-sdk is patched ['#'], ['%'], ['%20'], @@ -131,7 +131,7 @@ public static function directoryProvider(): array { ['folder with space'], ['spéciäl földer'], ['test single\'quote'], - ['0'], + /*['0'],*/ // disabled until upstream aws-sdk is patched ['#'], ['%'], ['%20'],