Skip to content

Commit c1093cd

Browse files
committed
merge dev
2 parents 9cec5ff + 8cd6b12 commit c1093cd

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,9 +350,13 @@ public function prepare_upload( $post ) {
350350
$public_id = $post->{Sync::META_KEYS['public_id']}; // use the __get method on the \WP_Post to get post_meta.
351351
$dirs = wp_get_upload_dir();
352352
$cld_folder = false;
353+
$folder = trailingslashit( $dirs['cloudinary_folder'] );
354+
if ( '/' === $dirs['cloudinary_folder'] ) {
355+
$folder = '';
356+
}
353357
if ( empty( $public_id ) ) {
354358
$file_info = pathinfo( $file );
355-
$public_id = trailingslashit( $dirs['cloudinary_folder'] ) . $file_info['filename'];
359+
$public_id = $folder . $file_info['filename'];
356360
}
357361

358362
// Check if cloudinary folder is in public_id.

cloudinary-image-management-and-manipulation-in-the-cloud-cdn/ui-definitions/tabs/settings-sync-media.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
'cloudinary_folder' => array(
1717
'label' => __( 'Cloudinary folder path', 'cloudinary' ),
1818
'description' => __( 'Specify the folder in your Cloudinary account where WordPress assets are uploaded to. All assets uploaded to WordPress from this point on will be synced to the specified folder in Cloudinary.', 'cloudinary' ),
19-
'default' => trim( $base['host'], '/' ),
19+
'default' => '/',
2020
'sanitize_callback' => array( '\Cloudinary\Media', 'sanitize_cloudinary_folder' ),
2121
'required' => true,
2222
'suffix' => '<button type="submit" class="button button-primary">' . __( 'Save folder settings', 'cloudinary' ) . '</button>',

0 commit comments

Comments
 (0)