[wp-trac] [WordPress Trac] #32519: Enqueueing styles with directory separator

WordPress Trac noreply at wordpress.org
Thu May 28 12:23:27 UTC 2015


#32519: Enqueueing styles with directory separator
---------------------------+----------------------
 Reporter:  doecode        |       Owner:
     Type:  defect (bug)   |      Status:  closed
 Priority:  normal         |   Milestone:
Component:  Script Loader  |     Version:  4.2
 Severity:  normal         |  Resolution:  invalid
 Keywords:                 |     Focuses:
---------------------------+----------------------
Changes (by rmccue):

 * status:  new => closed
 * resolution:   => invalid
 * milestone:  Awaiting Review =>


Comment:

 Thanks for reporting this issue! :)

 `wp_enqueue_*` takes a URL rather than a path, and `\` is not a valid
 character in URLs (but can be encoded as `%5C`). These enqueued URLs are
 then passed through URL sanitisation (`esc_url`), which strips invalid
 characters.

 You can pass your paths through `wp_normalize_path` to convert backslashes
 to forward slashes, however keep in mind that you typically don't want to
 bother with `DIRECTORY_SEPARATOR` anyway. Windows can handle forward
 slashes as directory (folder) separators anyway, so it helps to simplify
 your code a bit.

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


More information about the wp-trac mailing list