PluginProbe
Media Cloud Sync / 1.4.2
Media Cloud Sync v1.4.2
1.4.2 1.4.1 1.4.0 1.3.12 1.3.11 1.3.10 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.2.0 1.2.10 1.2.11 1.2.12 1.2.13 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 All 36 releases
← All changes | includes/sdk/s3/Aws/S3/ObjectCopier.php +5 -2 1.2.6 → 1.4.2 View file →
@@ -7,8 +7,9 @@
7 7 use Dudlewebs\WPMCS\s3\Aws\Exception\MultipartUploadException;
8 8 use Dudlewebs\WPMCS\s3\Aws\Result;
9 9 use Dudlewebs\WPMCS\s3\Aws\S3\Exception\S3Exception;
10 10 use Dudlewebs\WPMCS\s3\GuzzleHttp\Promise\Coroutine;
11 +use Dudlewebs\WPMCS\s3\GuzzleHttp\Promise\PromiseInterface;
11 12 use Dudlewebs\WPMCS\s3\GuzzleHttp\Promise\PromisorInterface;
12 13 use InvalidArgumentException;
13 14 /**
14 15 * Copies objects from one S3 location to another, utilizing a multipart copy
@@ -60,9 +61,9 @@
60 61 * operation or rejected with an exception.
61 62 *
62 63 * @return Coroutine
63 64 */
64 - public function promise()
65 + public function promise() : PromiseInterface
65 66 {
66 67 return Coroutine::of(function () {
67 68 $headObjectCommand = $this->client->getCommand('HeadObject', $this->options['params'] + $this->source);
68 69 if (\is_callable($this->options['before_lookup'])) {
@@ -99,16 +100,18 @@
99 100 }
100 101 }
101 102 private function getSourcePath()
102 103 {
104 + $path = "/{$this->source['Bucket']}/";
103 105 if (ArnParser::isArn($this->source['Bucket'])) {
104 106 try {
105 107 new AccessPointArn($this->source['Bucket']);
108 + $path = "{$this->source['Bucket']}/object/";
106 109 } catch (\Exception $e) {
107 110 throw new \InvalidArgumentException('Provided ARN was a not a valid S3 access point ARN (' . $e->getMessage() . ')', 0, $e);
108 111 }
109 112 }
110 - $sourcePath = "/{$this->source['Bucket']}/" . \rawurlencode($this->source['Key']);
113 + $sourcePath = $path . \rawurlencode($this->source['Key']);
111 114 if (isset($this->source['VersionId'])) {
112 115 $sourcePath .= "?versionId={$this->source['VersionId']}";
113 116 }
114 117 return $sourcePath;