You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Last image from post content (post_type=post) duplicates first image of the same post (if more than one image presents) when WooCommerce enabled alongside with ilab-media-tools plugin (WordPress store link)
Here's what I did: fresh WordPress, only WooCommerce and Media Tools installed. Twentytwentyfive theme, new post, 3 images (pic rel). While plugins is disabled, I get this:
When any of two plugins enabled by its own, the picture is the same, but when I enable two of them simultaneously, I get this picture:
Set Media Tools up with any data (important part is to turn Enable Cloud Storage checkbox on)
Create a post with at least two images in its content
Open the post and ensure of the bug
Expected behavior
Last image of the post renders as it is
Screenshots
If applicable, add screenshots to help explain your problem.
Server (please complete the following information)
Server Info: Apache/2.4.62 (Debian)
PHP Version: 8.1.31
PHP Post Max Size: 8 MB
PHP Time Limit: 30
PHP Max Input Vars: 1000
cURL Version: 7.88.1
OpenSSL/3.0.15
WordPress 6.7.1
How did you install the plugin?
Via composer from wpackagist
Additional context
Same issue in WooCommerce repo: woocommerce/woocommerce#56333
The bug appears only when Enable Cloud Storage checkbox is on, even if images are uploaded locally in wp-content/uploads and only when Replace URLs checkbox is on
The text was updated successfully, but these errors were encountered:
Okay, finally figured io out
So, we have \Automattic\WooCommerce\Blocks\BlockTypesController::add_data_attributes() and its trim( $content ); line
And now we have \MediaCloud\Plugin\Tools\Storage\StorageContentHooks::fixGutenbergFigures() with its preg_matches. The problem is that preg_match is greedy by default and specifically preg_match('/class\s*=\s*(?:.*)wp-image-([0-9]+)/m', $figureMatch, $imageIdMatches) seems to match ALL the trimmed string, which would be all of the post content's HTML.
Here's a PR that fixes this behavior, please, accept it ASAP #248
Describe the bug
Last image from post content (post_type=
post
) duplicates first image of the same post (if more than one image presents) when WooCommerce enabled alongside with ilab-media-tools plugin (WordPress store link)Here's what I did: fresh WordPress, only WooCommerce and Media Tools installed. Twentytwentyfive theme, new post, 3 images (pic rel). While plugins is disabled, I get this:

When any of two plugins enabled by its own, the picture is the same, but when I enable two of them simultaneously, I get this picture:

To Reproduce
Enable Cloud Storage
checkbox on)Expected behavior
Last image of the post renders as it is
Screenshots
If applicable, add screenshots to help explain your problem.
Server (please complete the following information)
Server Info: Apache/2.4.62 (Debian)
PHP Version: 8.1.31
PHP Post Max Size: 8 MB
PHP Time Limit: 30
PHP Max Input Vars: 1000
cURL Version: 7.88.1
OpenSSL/3.0.15
WordPress 6.7.1
How did you install the plugin?
Via composer from wpackagist
Additional context
Same issue in WooCommerce repo: woocommerce/woocommerce#56333
The bug appears only when
Enable Cloud Storage
checkbox is on, even if images are uploaded locally in wp-content/uploads and only whenReplace URLs
checkbox is onThe text was updated successfully, but these errors were encountered: