WordPress.org

Make WordPress Core

Ticket #50855: 50855.diff

File 50855.diff, 646 bytes (added by audrasjb, 5 months ago)

Formatting: Reprioritization of the characters to remove from filenames in sanitize_file_name()

  • src/wp-includes/formatting.php

    diff --git a/src/wp-includes/formatting.php b/src/wp-includes/formatting.php
    index b716c6bc1f..230a67aec0 100644
    a b function sanitize_file_name( $filename ) { 
    20172017         */
    20182018        $special_chars = apply_filters( 'sanitize_file_name_chars', $special_chars, $filename_raw );
    20192019
    2020         $filename = str_replace( $special_chars, '', $filename );
    20212020        $filename = str_replace( array( '%20', '+' ), '-', $filename );
     2021        $filename = str_replace( $special_chars, '', $filename );
    20222022        $filename = preg_replace( '/[\r\n\t -]+/', '-', $filename );
    20232023        $filename = trim( $filename, '.-_' );
    20242024