[wp-trac] [WordPress Trac] #36308: get_attached_file() destroys file paths on Windows

WordPress Trac noreply at wordpress.org
Wed Aug 24 17:46:50 UTC 2022


#36308: get_attached_file() destroys file paths on Windows
-------------------------------------------------+-------------------------
 Reporter:  Whissi                               |       Owner:  antpb
     Type:  defect (bug)                         |      Status:  reopened
 Priority:  normal                               |   Milestone:  6.1
Component:  Media                                |     Version:  4.4.2
 Severity:  normal                               |  Resolution:
 Keywords:  has-unit-tests has-testing-info      |     Focuses:
  needs-testing early commit                     |
-------------------------------------------------+-------------------------

Comment (by jrf):

 @antpb and me just got together in a call to investigate.

 Preliminary conclusion: it's not so much this patch which is the problem,
 this patch just exposed a (much larger) underlying problem with slash
 normalization and Windows slashes getting removed from paths and more.

 The fact that I discovered this now has more to do with an edge case set-
 up on my Windows machine (a subdirectory in the path to WP starting with a
 numeric `0`), though that doesn't negate the underlying issue (it just
 helped to discover it).

 @antpb will write up a new issue for this.

 While looking at the code, we saw two small coding standards issues which
 should be fixed. There weren't introduced in this patch, but were in the
 functions touched in the patch.

 I've uploaded a patch file with the fixes for those.

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


More information about the wp-trac mailing list