[wp-trac] [WordPress Trac] #22813: Media Uploader doesn't escape "+" in filenames and doesn't upload file

WordPress Trac noreply at wordpress.org
Thu Aug 15 07:29:29 UTC 2013


#22813: Media Uploader doesn't escape "+" in filenames and doesn't upload file
----------------------------------------+------------------------------
 Reporter:  devinreams                  |       Owner:
     Type:  defect (bug)                |      Status:  new
 Priority:  normal                      |   Milestone:  Awaiting Review
Component:  Media                       |     Version:  3.4.2
 Severity:  normal                      |  Resolution:
 Keywords:  has-patch needs-unit-tests  |
----------------------------------------+------------------------------

Comment (by jamescollins):

 Replying to [comment:16 nacin]:
 > Perhaps it is just a matter of replacing ' ' with '+'?

 Agreed. {{{22813-ms-files.diff​}}} is a relatively simple solution I
 think.

 It fixes existing uploaded files for me (Apache 2.2.22). I don't have an
 nginx install to test the patch on though.


 > I guess we could ask them if they are using the sanitize_file_name_chars
 filter to add in others, or doing some other kind of en/decoding or
 sanitization.

 Not a bad idea to check with them. I've been using this on our multisite
 installs since April, and it hasn't caused any issues.

 {{{
 function my_sanitize_file_name_chars( $special_chars, $filename_raw ) {
         if ( ! in_array( "+", $special_chars ) )
                 $special_chars[] = "+";
         return $special_chars;
 }
 add_filter( 'sanitize_file_name_chars', 'my_sanitize_file_name_chars', 10,
 2 );
 }}}

--
Ticket URL: <http://core.trac.wordpress.org/ticket/22813#comment:17>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list