Commit 7860bbc1 authored by SergeyBiryukov's avatar SergeyBiryukov
Browse files

Media: Remove accents in `sanitize_file_name()`.

This brings some consistency with `sanitize_title()` and `sanitize_user()`.

Props tar.gz, NumidWasNotAvailable, juliobox, p_enrique, cristovaov, zodiac1978, mikeschroder, markoheijnen, chriscct7, swissspidy, DrProtocols, pento, gitlost, joemcgill, dustinbolton, programmin, Vayu, MaximeCulea, lucasbustamante, nilovelez, RavanH, audrasjb, SergeyBiryukov.
See #22363.
Built from https://develop.svn.wordpress.org/trunk@48603


git-svn-id: https://core.svn.wordpress.org/trunk@48365 1a063a9b-81f0-0310-95a4-ce76da25c4cd
parent 79a7d970
Loading
Loading
Loading
Loading
+10 −5
Original line number Diff line number Diff line
@@ -1985,6 +1985,8 @@ function remove_accents( $string ) {
 */
function sanitize_file_name( $filename ) {
	$filename_raw = $filename;
	$filename     = remove_accents( $filename );

	$special_chars = array( '?', '[', ']', '/', '\\', '=', '<', '>', ':', ';', ',', "'", '"', '&', '$', '#', '*', '(', ')', '|', '~', '`', '!', '{', '}', '%', '+', '’', '«', '»', '”', '“', chr( 0 ) );

	// Check for support for utf8 in the installed PCRE library once and store the result in a static.
@@ -2013,6 +2015,7 @@ function sanitize_file_name( $filename ) {
	 * @param string   $filename_raw  The original filename to be sanitized.
	 */
	$special_chars = apply_filters( 'sanitize_file_name_chars', $special_chars, $filename_raw );

	$filename = str_replace( $special_chars, '', $filename );
	$filename = str_replace( array( '%20', '+' ), '-', $filename );
	$filename = preg_replace( '/[\r\n\t -]+/', '-', $filename );
@@ -2068,7 +2071,9 @@ function sanitize_file_name( $filename ) {
			}
		}
	}

	$filename .= '.' . $extension;

	/** This filter is documented in wp-includes/formatting.php */
	return apply_filters( 'sanitize_file_name', $filename, $filename_raw );
}
+1 −1
Original line number Diff line number Diff line
@@ -13,7 +13,7 @@
 *
 * @global string $wp_version
 */
$wp_version = '5.5-beta3-48602';
$wp_version = '5.5-beta3-48603';

/**
 * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.