Changeset 46980
- Timestamp:
- 12/17/2019 09:18:07 PM (5 years ago)
- Location:
- branches/5.3
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/5.3
- Property svn:mergeinfo changed
/trunk merged: 46966,46976
- Property svn:mergeinfo changed
-
branches/5.3/src/wp-includes/functions.php
r46979 r46980 2411 2411 // Sanitize the file name before we begin processing. 2412 2412 $filename = sanitize_file_name( $filename ); 2413 $ext2 = null; 2413 2414 2414 2415 // Separate the filename into a name and extension. … … 2486 2487 2487 2488 if ( ! empty( $files ) ) { 2488 while ( _wp_check_existing_file_names( $filename, $files ) ) { 2489 // The extension case may have changed above. 2490 $new_ext = ! empty( $ext2 ) ? $ext2 : $ext; 2491 2492 // Ensure this never goes into infinite loop 2493 // as it uses pathinfo() and regex in the check but string replacement for the changes. 2494 $count = count( $files ); 2495 $i = 0; 2496 2497 while ( $i <= $count && _wp_check_existing_file_names( $filename, $files ) ) { 2489 2498 $new_number = (int) $number + 1; 2490 $filename = str_replace( array( "-{$number}{$ ext}", "{$number}{$ext}" ), "-{$new_number}{$ext}", $filename );2499 $filename = str_replace( array( "-{$number}{$new_ext}", "{$number}{$new_ext}" ), "-{$new_number}{$new_ext}", $filename ); 2491 2500 $number = $new_number; 2501 $i++; 2492 2502 } 2493 2503 } … … 2531 2541 } 2532 2542 2533 $regex = '/^' . preg_quote( $fname ) . '-(?:\d+x\d+|scaled|rotated)' . preg_quote( $ext ) . '$/ ';2543 $regex = '/^' . preg_quote( $fname ) . '-(?:\d+x\d+|scaled|rotated)' . preg_quote( $ext ) . '$/i'; 2534 2544 2535 2545 foreach ( $files as $file ) { -
branches/5.3/tests/phpunit/tests/functions.php
r46979 r46980 209 209 // Existing files: one-blue-pixel-100x100.png, one-blue-pixel-1-100x100.png. 210 210 $this->assertEquals( 'one-blue-pixel-2.png', wp_unique_filename( $testdir, 'one-blue-pixel.png' ) ); 211 // Same as above with upper case extension. 212 $this->assertEquals( 'one-blue-pixel-2.png', wp_unique_filename( $testdir, 'one-blue-pixel.PNG' ) ); 211 213 212 214 remove_filter( 'upload_dir', array( $this, 'upload_dir_patch_basedir' ) );
Note: See TracChangeset
for help on using the changeset viewer.