From 3522819624ecf3b245ecb1682d0aa44e8c7280e9 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Tue, 26 Nov 2024 16:49:55 +0100 Subject: [PATCH 1/3] fix: throw correct exception type when we can't verify if an s3 bucket exists Signed-off-by: Robin Appelman --- lib/private/Files/ObjectStore/S3ConnectionTrait.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/private/Files/ObjectStore/S3ConnectionTrait.php b/lib/private/Files/ObjectStore/S3ConnectionTrait.php index 0506eb3535345..c5180bb982ab6 100644 --- a/lib/private/Files/ObjectStore/S3ConnectionTrait.php +++ b/lib/private/Files/ObjectStore/S3ConnectionTrait.php @@ -13,6 +13,7 @@ use Aws\S3\S3Client; use GuzzleHttp\Promise\Create; use GuzzleHttp\Promise\RejectedPromise; +use OCP\Files\StorageNotAvailableException; use OCP\ICertificateManager; use OCP\Server; use Psr\Log\LoggerInterface; @@ -127,12 +128,12 @@ public function getConnection() { $logger->debug('Bucket "' . $this->bucket . '" This bucket name is not dns compatible, it may contain invalid characters.', ['app' => 'objectstore']); } - + if ($this->params['verify_bucket_exists'] && !$this->connection->doesBucketExist($this->bucket)) { try { $logger->info('Bucket "' . $this->bucket . '" does not exist - creating it.', ['app' => 'objectstore']); if (!$this->connection::isBucketDnsCompatible($this->bucket)) { - throw new \Exception("The bucket will not be created because the name is not dns compatible, please correct it: " . $this->bucket); + throw new StorageNotAvailableException("The bucket will not be created because the name is not dns compatible, please correct it: " . $this->bucket); } $this->connection->createBucket(['Bucket' => $this->bucket]); $this->testTimeout(); @@ -142,17 +143,17 @@ public function getConnection() { 'app' => 'objectstore', ]); if ($e->getAwsErrorCode() !== 'BucketAlreadyOwnedByYou') { - throw new \Exception('Creation of bucket "' . $this->bucket . '" failed. ' . $e->getMessage()); + throw new StorageNotAvailableException('Creation of bucket "' . $this->bucket . '" failed. ' . $e->getMessage()); } } } - + // google cloud's s3 compatibility doesn't like the EncodingType parameter if (strpos($base_url, 'storage.googleapis.com')) { $this->connection->getHandlerList()->remove('s3.auto_encode'); } } catch (S3Exception $e) { - throw new \Exception('S3 service is unable to handle request: ' . $e->getMessage()); + throw new StorageNotAvailableException('S3 service is unable to handle request: ' . $e->getMessage()); } return $this->connection; From 44727d4862a340433b2954ac319ccf6ad65bc75f Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Tue, 26 Nov 2024 17:08:48 +0100 Subject: [PATCH 2/3] fix: fix availability wrapper not applying Signed-off-by: Robin Appelman --- lib/private/Files/SetupManager.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/private/Files/SetupManager.php b/lib/private/Files/SetupManager.php index 3a3f7ba9c11a9..4d1e379ea582d 100644 --- a/lib/private/Files/SetupManager.php +++ b/lib/private/Files/SetupManager.php @@ -24,7 +24,7 @@ use OC_App; use OC_Hook; use OC_Util; -use OCA\Files_External\Config\ConfigAdapter; +use OCA\Files_External\Config\ExternalMountPoint; use OCA\Files_Sharing\External\Mount; use OCA\Files_Sharing\ISharedMountPoint; use OCA\Files_Sharing\SharedMount; @@ -134,7 +134,7 @@ function ($mountPoint, IStorage $storage, IMountPoint $mount) use ($reSharingEna // install storage availability wrapper, before most other wrappers Filesystem::addStorageWrapper('oc_availability', function ($mountPoint, IStorage $storage, IMountPoint $mount) { - $externalMount = $mount instanceof ConfigAdapter || $mount instanceof Mount; + $externalMount = $mount instanceof ExternalMountPoint || $mount instanceof Mount; if ($externalMount && !$storage->isLocal()) { return new Availability(['storage' => $storage]); } From 3ab58abfeb11b37bb4259a487d4c053cf93b69fc Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Tue, 26 Nov 2024 18:09:33 +0100 Subject: [PATCH 3/3] test: attempt to fix smb sso test Signed-off-by: Robin Appelman --- .github/workflows/files-external-smb-kerberos.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/files-external-smb-kerberos.yml b/.github/workflows/files-external-smb-kerberos.yml index 2e09d3386d828..62a96b707ee59 100644 --- a/.github/workflows/files-external-smb-kerberos.yml +++ b/.github/workflows/files-external-smb-kerberos.yml @@ -53,6 +53,12 @@ jobs: repository: nextcloud/user_saml path: apps/user_saml + - name: Install user_saml + run: | + cd apps/user_saml + composer i + cd ../.. + - name: Pull images run: | docker pull ghcr.io/icewind1991/samba-krb-test-dc