Skip to content

Commit 85d6392

Browse files
committed
set header to file if cloud_name sync type.
1 parent bb06d57 commit 85d6392

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/sync/class-upload-sync.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -201,9 +201,10 @@ public function setup() {
201201
*/
202202
public function upload_asset( $attachment_id ) {
203203

204-
$type = $this->sync->get_sync_type( $attachment_id );
205-
$options = $this->media->get_upload_options( $attachment_id );
206-
$public_id = $options['public_id'];
204+
$type = $this->sync->get_sync_type( $attachment_id );
205+
$options = $this->media->get_upload_options( $attachment_id );
206+
$public_id = $options['public_id'];
207+
$try_remote = 'cloud_name' === $type ? 'file' : false;
207208

208209
// Add the suffix before uploading.
209210
if ( $this->media->get_public_id( $attachment_id ) === $public_id ) {
@@ -215,7 +216,7 @@ public function upload_asset( $attachment_id ) {
215216
}
216217

217218
// Run the upload Call.
218-
$result = $this->connect->api->upload( $attachment_id, $options );
219+
$result = $this->connect->api->upload( $attachment_id, $options, $try_remote );
219220

220221
if ( ! is_wp_error( $result ) ) {
221222

0 commit comments

Comments
 (0)