From c059d25e4795bbf3ed224f0491a48df55cfd7dda Mon Sep 17 00:00:00 2001 From: Sean O'Brien Date: Mon, 25 Nov 2024 13:47:24 -0500 Subject: [PATCH] bugfix: s3 path handling --- src/Api/Serializer/RestSerializer.php | 7 +++++-- src/Api/Service.php | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Api/Serializer/RestSerializer.php b/src/Api/Serializer/RestSerializer.php index b13e1de4cb..7ec7dc71de 100644 --- a/src/Api/Serializer/RestSerializer.php +++ b/src/Api/Serializer/RestSerializer.php @@ -197,6 +197,7 @@ private function applyQuery($name, Shape $member, $value, array &$opts) private function buildEndpoint(Operation $operation, array $args, array $opts) { $isModifiedModel = $this->api->isModifiedModel(); + $serviceName = $this->api->getServiceName(); // Create an associative array of variable definitions used in expansions $varDefinitions = $this->getVarDefinitions($operation, $args); @@ -225,7 +226,7 @@ function (array $matches) use ($varDefinitions) { $path = $this->endpoint->getPath(); - if ($isModifiedModel && $this->api->getServiceName() === 's3') { + if ($isModifiedModel && $serviceName === 's3') { if (substr($path, -1) === '/' && $relative[0] === '/') { $path = rtrim($path, '/'); } @@ -242,7 +243,9 @@ function (array $matches) use ($varDefinitions) { } } - if (!$isModifiedModel) { + if (!$isModifiedModel + && $serviceName !== 's3' + ) { $relative = $this->prependPath($relative, $path); } diff --git a/src/Api/Service.php b/src/Api/Service.php index 5d7675befc..6ebd7ed664 100644 --- a/src/Api/Service.php +++ b/src/Api/Service.php @@ -219,7 +219,7 @@ public function getSigningName() */ public function getServiceName() { - return $this->definition['metadata']['serviceIdentifier']; + return $this->definition['metadata']['serviceIdentifier'] ?? null; } /**