[wp-trac] [WordPress Trac] #42437: Thumbnails can overwrite other uploads if filename matches

WordPress Trac noreply at wordpress.org
Thu Dec 5 02:26:54 UTC 2019


#42437: Thumbnails can overwrite other uploads if filename matches
-------------------------------------------------+-------------------------
 Reporter:  Viper007Bond                         |       Owner:  pbiron
     Type:  defect (bug)                         |      Status:  assigned
 Priority:  normal                               |   Milestone:  5.3.1
Component:  Upload                               |     Version:  4.8.3
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch needs-testing needs-unit-  |     Focuses:
  tests                                          |
-------------------------------------------------+-------------------------

Comment (by pbiron):

 Replying to [comment:39 azaozz]:
 > In 42437.3.diff:
 > - Based on 42437.2.diff.
 > - Remove the case 1 above "Adds a number to any file that could cause a
 collision with sub-sizes.". Can cause "false-positives" and perhaps better
 to not rename the file unless we have to.
 > - Ensure the `$number` is reused across different tests so it doesn't
 end up with name like `file-1-2.ext`.
 > - Use a helper function to test for possible collisions.
 > - Some code improvements.

 I'll try to give it some testing tomorrow.

 One thing: with "case 1" removed, the 1st `assertEquals()` in the unit
 test needs to be removed, because it will fail.

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


More information about the wp-trac mailing list