Upload: Run the final file name collision test in wp_unique_filename()
for each existing file + 1.
Props pbiron. See #48975. git-svn-id: https://develop.svn.wordpress.org/trunk@46976 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
a4b65bfca8
commit
a276995ff9
@ -2492,7 +2492,7 @@ function wp_unique_filename( $dir, $filename, $unique_filename_callback = null )
|
|||||||
// Ensure this never goes into infinite loop
|
// Ensure this never goes into infinite loop
|
||||||
// as it uses pathinfo() and regex in the check but string replacement for the changes.
|
// as it uses pathinfo() and regex in the check but string replacement for the changes.
|
||||||
$count = count( $files );
|
$count = count( $files );
|
||||||
$i = 1;
|
$i = 0;
|
||||||
|
|
||||||
while ( $i <= $count && _wp_check_existing_file_names( $filename, $files ) ) {
|
while ( $i <= $count && _wp_check_existing_file_names( $filename, $files ) ) {
|
||||||
$new_number = (int) $number + 1;
|
$new_number = (int) $number + 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user