[wp-trac] [WordPress Trac] #16330: media_sideload_image() broken with filenames containing strange characters (e.g., +, %)
WordPress Trac
noreply at wordpress.org
Sun Apr 13 18:01:01 UTC 2014
#16330: media_sideload_image() broken with filenames containing strange characters
(e.g., +, %)
-------------------------------------------------+-------------------------
Reporter: Coolkevman | Owner:
Type: defect (bug) | Status: reopened
Priority: normal | Milestone: Future
Component: Media | Release
Severity: major | Version: 3.1
Keywords: has-patch needs-testing 3.5-early | Resolution:
needs-unit-tests | Focuses:
-------------------------------------------------+-------------------------
Comment (by mattheu):
I have run into this bug a couple of times trying to write a custom
importers for old content full of file urls with spaces in them.
* In order to sideload an image that has a space in the filename, you need
to correctly encode the spaces first.
* WordPress will then create a file with a filename that contains `%20;`
* Problem is... when you try and visit this, the browser interprets this
as a space. And image is broken.
I tested SergeyBiryuko's patch (16330.3.diff) This works well and solves
the problem. I updated the patch to merge cleanly with current trunk, and
updated sanitizeFileName unit test.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/16330#comment:33>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list