[wp-trac] [WordPress Trac] #36273: update_attached_file() on Windows will result in invalid image path when using native Windows directory separators

WordPress Trac noreply at wordpress.org
Wed May 13 09:00:00 UTC 2026


#36273: update_attached_file() on Windows will result in invalid image path when
using native Windows directory separators
----------------------------------------+------------------------------
 Reporter:  Whissi                      |       Owner:  (none)
     Type:  defect (bug)                |      Status:  new
 Priority:  normal                      |   Milestone:  Awaiting Review
Component:  Media                       |     Version:  4.4.2
 Severity:  normal                      |  Resolution:
 Keywords:  needs-unit-tests has-patch  |     Focuses:
----------------------------------------+------------------------------

Comment (by shreya0shrivastava):

 Hi, I was able to reproduce this issue on 7.1-alpha-62161-src and
 confirmed the bug is still present.

 The fix passes $file through wp_normalize_path() after
 _wp_relative_upload_path(),
 which converts all backslashes to forward slashes before the value is
 stored
 in postmeta, preventing wp_unslash() from corrupting the path.

 Submitted a patch. Happy to make any changes based on feedback!

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/36273#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list