• Resolved Paul Biron

    (@pbiron)


    When replacing a PNG image (with either Just replace the file or Replace the file, use the new file name, and update all links) on Windows, the _wp_attached_file postmeta ends up with the fill path the file rather than a path relative to the uploads folder. The file entry in the _wp_attachment_metadata postmeta also has the full path.

    I’ve confirmed that if I rollback to version 3.6.3 everything works fine (hurray for wp-cli for making that rollback easy :-).

    I’m not 100% sure, but I think the problem is in the new FileModel::processPath() method.

    That new method calls wp_normalize_path(), which among other things replaces windows “backslashes” in file paths to forward slashes. And that causes a problem with __wp_relative_upload_path(), because the basedir entry in the array returned by wp_get_upload_dir() on windows has backslashes, so __wp_relative_upload_path() doesn’t strip the basedir.

    OS: Win11 Pro for Workstations (21H2, 22000.918)
    PHP: 7.4.29
    WP: 6.0.2
    Apache: 2.4.53
    MySQL: 5.7.38

    Let me know if you need any other info to help replicate the problem.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Support Gerard Blanco

    (@sixaxis)

    Hi Paul,

    Thanks for your message. We already know about this and are investigating it, although we don’t know how much time this can take because it’s difficult for us to get a Windows environment ??

    Anyway, we’ll update you once we get to some conclusion.

    Thank you!

    Plugin Support Gerard Blanco

    (@sixaxis)

    Hi Paul,

    Just updating you that we finally managed to reproduce this issue and indeed, you are right. We added a task for this and will get it fixed soon.

    Thanks for your patience!

    Thread Starter Paul Biron

    (@pbiron)

    thanx for the update.

    Plugin Author Pedro

    (@petredobrescu)

    Hello,

    We have included a fix for this situation in this version of the plugin:

    https://shortpixel.com/downloads/enable-media-replace-4.0.1-DEV04.zip

    Can you please check with this version, preferably on a test/development environment, and let us know if it works correctly?

    Thank you!

    Thread Starter Paul Biron

    (@pbiron)

    Thanx Pedro!

    I’ve done a few tests (in the same environment as my original message, except WP is now updated to 6.1.1 and the OS is Win11 Pro f/ Workstations [22H2, 22621.819]), and it seems to be working great.

    I tested with both Just replace the file or Replace the file, use the new file name, and update all links, as well as replacing a PNG with A JPG and vice versa.

    Plugin Author Pedro

    (@petredobrescu)

    That’s great, thanks for the confirmation, Paul!

    When version 4.0.1 comes out next week, you can safely upgrade, because it contains this fix.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘regression in 4.0.0 on windows’ is closed to new replies.