Created
April 27, 2018 19:18
-
-
Save colepacak/80dfbe555ce7c2bffe213c5eb9aa0c70 to your computer and use it in GitHub Desktop.
aws/aws-sdk-php: S3Client Remove encoding type middleware
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/S3/S3Client.php b/src/S3/S3Client.php | |
index ac274eaa..b9f6f9f1 100644 | |
--- a/src/S3/S3Client.php | |
+++ b/src/S3/S3Client.php | |
@@ -290,7 +290,6 @@ class S3Client extends AwsClient implements S3ClientInterface | |
$stack->appendInit(Middleware::sourceFile($this->getApi()), 's3.source_file'); | |
$stack->appendInit($this->getSaveAsParameter(), 's3.save_as'); | |
$stack->appendInit($this->getLocationConstraintMiddleware(), 's3.location'); | |
- $stack->appendInit($this->getEncodingTypeMiddleware(), 's3.auto_encode'); | |
$stack->appendInit($this->getHeadObjectMiddleware(), 's3.head_object'); | |
} | |
@@ -427,62 +426,6 @@ class S3Client extends AwsClient implements S3ClientInterface | |
}; | |
} | |
- /** | |
- * Provides a middleware that autopopulates the EncodingType parameter on | |
- * ListObjects commands. | |
- * | |
- * @return \Closure | |
- */ | |
- private function getEncodingTypeMiddleware() | |
- { | |
- return static function (callable $handler) { | |
- return function (Command $command, $request = null) use ($handler) { | |
- $autoSet = false; | |
- if ($command->getName() === 'ListObjects' | |
- && empty($command['EncodingType']) | |
- ) { | |
- $command['EncodingType'] = 'url'; | |
- $autoSet = true; | |
- } | |
- | |
- return $handler($command, $request) | |
- ->then(function (ResultInterface $result) use ($autoSet) { | |
- if ($result['EncodingType'] === 'url' && $autoSet) { | |
- static $topLevel = [ | |
- 'Delimiter', | |
- 'Marker', | |
- 'NextMarker', | |
- 'Prefix', | |
- ]; | |
- static $nested = [ | |
- ['Contents', 'Key'], | |
- ['CommonPrefixes', 'Prefix'], | |
- ]; | |
- | |
- foreach ($topLevel as $key) { | |
- if (isset($result[$key])) { | |
- $result[$key] = urldecode($result[$key]); | |
- } | |
- } | |
- foreach ($nested as $steps) { | |
- if (isset($result[$steps[0]])) { | |
- foreach ($result[$steps[0]] as $key => $part) { | |
- if (isset($part[$steps[1]])) { | |
- $result[$steps[0]][$key][$steps[1]] | |
- = urldecode($part[$steps[1]]); | |
- } | |
- } | |
- } | |
- } | |
- | |
- } | |
- | |
- return $result; | |
- }); | |
- }; | |
- }; | |
- } | |
- | |
/** @internal */ | |
public static function _applyRetryConfig($value, $_, HandlerList $list) | |
{ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment