Skip to content

Commit 173490a

Browse files
author
Md. Alimuzzaman Alim
committed
FIx for accent characters media file #272
1 parent 024e200 commit 173490a

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/classes/class-utility.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ public static function add_media( $metadata, $attachment_id, $force = false ) {
238238
if( !empty( $metadata[ 'sizes' ] ) && is_array( $metadata[ 'sizes' ] ) ) {
239239

240240
$path = wp_normalize_path( dirname( get_attached_file( $attachment_id ) ) );
241-
$mediaPath = wp_normalize_path( trim( str_replace( basename( $metadata[ 'file' ] ), '', $metadata[ 'file' ] ), '\/\\' ) );
241+
$mediaPath = wp_normalize_path( trim( dirname( $metadata[ 'file' ] ), '\/\\' ) );
242242

243243
foreach( (array) $metadata[ 'sizes' ] as $image_size => $data ) {
244244

lib/classes/compatibility/shortpixel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ public static function add_media( $metadata, $attachment_id ) {
271271
if( !empty( $metadata[ 'sizes' ] ) && is_array( $metadata[ 'sizes' ] ) ) {
272272

273273
$path = wp_normalize_path( dirname( get_attached_file( $attachment_id ) ) );
274-
$mediaPath = wp_normalize_path( trim( str_replace( basename( $metadata[ 'file' ] ), '', $metadata[ 'file' ] ), '\/\\' ) );
274+
$mediaPath = wp_normalize_path( trim( dirname( $metadata[ 'file' ] ), '\/\\' ) );
275275

276276
foreach( (array) $metadata[ 'sizes' ] as $image_size => $data ) {
277277

0 commit comments

Comments
 (0)