Skip to content

Commit

Permalink
code standard
Browse files Browse the repository at this point in the history
implement review changes and maintain code standard
  • Loading branch information
thiyaguk09 committed Dec 10, 2024
1 parent e9c05ce commit a0fb38d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 15 deletions.
20 changes: 7 additions & 13 deletions Storage/src/SigningHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,11 +185,9 @@ public function v2Sign(ConnectionInterface $connection, $expires, $resource, $ge
$stringToSign = $this->createV2CanonicalRequest($toSign);

// Use exponential backOff
$signature = $this->retrySignBlob(function () use ($credentials, $stringToSign, $options) {
return $credentials->signBlob($stringToSign, [
'forceOpenssl' => $options['forceOpenssl']
]);
});
$signature = $this->retrySignBlob(fn () => $credentials->signBlob($stringToSign, [
'forceOpenssl' => $options['forceOpenssl']
]));

// Start with user-provided query params and add required parameters.
$params = $options['queryParams'];
Expand Down Expand Up @@ -343,15 +341,11 @@ public function v4Sign(ConnectionInterface $connection, $expires, $resource, $ge
$requestHash
]);

$signature = bin2hex(base64_decode($this->retrySignBlob(function () use (
$credentials,
$stringToSign,
$options
) {
return $credentials->signBlob($stringToSign, [
$signature = bin2hex(base64_decode($this->retrySignBlob(
fn() => $credentials->signBlob($stringToSign, [
'forceOpenssl' => $options['forceOpenssl']
]);
})));
])
)));

// Construct the modified resource name. If a custom hostname is provided,
// this will remove the bucket name from the resource.
Expand Down
3 changes: 1 addition & 2 deletions Storage/tests/Unit/SigningHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -819,6 +819,7 @@ public function testRetrySignBlobSuccessAfterRetries()
]);

$this->assertEquals('signature', $res);
$this->assertEquals(3, $attempt);
}

public function testRetrySignBlobNonRetryableError()
Expand All @@ -833,8 +834,6 @@ public function testRetrySignBlobNonRetryableError()
$res = $this->helper->proxyPrivateMethodCall('retrySignBlob', [
$signBlobFn
]);

$this->assertEquals('Non-retryable error', $res);
}
}

Expand Down

0 comments on commit a0fb38d

Please sign in to comment.