Skip to content

Commit b4ef389

Browse files
authored
bugfix: s3 path handling (#3038)
1 parent dd1b65a commit b4ef389

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/Api/Serializer/RestSerializer.php

+5-2
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ private function applyQuery($name, Shape $member, $value, array &$opts)
197197
private function buildEndpoint(Operation $operation, array $args, array $opts)
198198
{
199199
$isModifiedModel = $this->api->isModifiedModel();
200+
$serviceName = $this->api->getServiceName();
200201
// Create an associative array of variable definitions used in expansions
201202
$varDefinitions = $this->getVarDefinitions($operation, $args);
202203

@@ -225,7 +226,7 @@ function (array $matches) use ($varDefinitions) {
225226

226227
$path = $this->endpoint->getPath();
227228

228-
if ($isModifiedModel && $this->api->getServiceName() === 's3') {
229+
if ($isModifiedModel && $serviceName === 's3') {
229230
if (substr($path, -1) === '/' && $relative[0] === '/') {
230231
$path = rtrim($path, '/');
231232
}
@@ -242,7 +243,9 @@ function (array $matches) use ($varDefinitions) {
242243
}
243244
}
244245

245-
if (!$isModifiedModel) {
246+
if (!$isModifiedModel
247+
&& $serviceName !== 's3'
248+
) {
246249
$relative = $this->prependPath($relative, $path);
247250
}
248251

src/Api/Service.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ public function getSigningName()
219219
*/
220220
public function getServiceName()
221221
{
222-
return $this->definition['metadata']['serviceIdentifier'];
222+
return $this->definition['metadata']['serviceIdentifier'] ?? null;
223223
}
224224

225225
/**

0 commit comments

Comments
 (0)