[wp-trac] [WordPress Trac] #48975: Fix unhandled upper/lower case change in wp_unique_filename()

WordPress Trac noreply at wordpress.org
Tue Dec 17 00:44:42 UTC 2019


#48975: Fix unhandled upper/lower case change in wp_unique_filename()
-------------------------------------------------+-------------------------
 Reporter:  azaozz                               |       Owner:  azaozz
     Type:  defect (bug)                         |      Status:  reopened
 Priority:  high                                 |   Milestone:  5.3.2
Component:  Upload                               |     Version:  5.3.1
 Severity:  major                                |  Resolution:
 Keywords:  has-patch 2nd-opinion has-unit-      |     Focuses:
  tests fixed-major                              |
-------------------------------------------------+-------------------------

Comment (by azaozz):

 Replying to [comment:12 pbiron]:
 > ...which means that there would (could?) still be a conflict.

 Right, think it needs to run one more time, i.e. count + 1. To do that
 need to set `$i = 0;` initially.

 We check one string (file name) against an array of possible matches. If
 there are 5 files in the dir (array has 5 elements) and all have names
 that match, the 6th run will add `-6` to the file name making it
 different.


 > 2. should we add add unit tests that specifically test for that case
 (and the one #48960)?

 Sure, the more tests -- the better :)

 > 3. similarly, the last 2 assertions in
 `test_unique_filename_with_dimension_like_filename()` have a comment that
 certain files should exist is `DIR_TESTDATA . '/images/'`...

 Yeah, makes sense to confirm the files actually exist. The tests fill fail
 if they don't so it would be pretty easy top spot if any of them is
 deleted, but having a test will point to the right reason :)

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


More information about the wp-trac mailing list