Skip to content

Commit c60cfab

Browse files
author
Marco Pereirinha
committed
Do not remove twice the file extension
1 parent 12589c5 commit c60cfab

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

php/media/class-upgrade.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,10 @@ public function convert_cloudinary_version( $attachment_id ) {
9494
}
9595
}
9696
// Build public_id.
97-
$parts = array_filter( $id_parts );
98-
$public_id = implode( '/', $parts );
99-
// Remove extension.
100-
$path = pathinfo( $public_id );
101-
$public_id = str_replace( $path['basename'], $path['filename'], $public_id );
97+
$parts = array_filter( $id_parts );
98+
if ( empty( $public_id ) ) {
99+
$public_id = implode( '/', $parts );
100+
}
102101
update_post_meta( $attachment_id, Sync::META_KEYS['public_id'], $public_id );
103102
$this->media->update_post_meta( $attachment_id, Sync::META_KEYS['version'], $asset_version );
104103
if ( ! empty( $asset_transformations ) ) {

0 commit comments

Comments
 (0)