[wp-trac] [WordPress Trac] #20057: Media upload for multi-webserver setups introduces a nasty race condition that could corrupt uploaded files

WordPress Trac wp-trac at lists.automattic.com
Wed Jul 25 10:27:26 UTC 2012


#20057: Media upload for multi-webserver setups introduces a nasty race condition
that could corrupt uploaded files
--------------------------+------------------------------
 Reporter:  archon810     |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Media         |     Version:  3.3.1
 Severity:  major         |  Resolution:
 Keywords:                |
--------------------------+------------------------------

Comment (by archon810):

 Upon further research, the second call to sanitize_file_name() happens via
 mw_newMediaObject() -> wp_upload_bits() -> wp_unique_filename() ->
 sanitize_file_name().

 The first call is in mw_newMediaObject() -> sanitize_file_name().

 Because of this, as I mentioned, sanitize_file_name() fires twice. I guess
 I could do a check on the prefix in my filter and skip applying it if it
 already exists, but it still feels a bit dirty and wrong to me.

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


More information about the wp-trac mailing list