Make WordPress Core

Ticket #50855: sanitize-file-name.patch

File sanitize-file-name.patch, 841 bytes (added by dishitpala, 4 years ago)
  • wp-includes/formatting.php

    diff --git a/wp-includes/formatting.php b/wp-includes/formatting.php
    index d031656d43..4171a570e0 100644
    a b function sanitize_file_name( $filename ) { 
    20062006                $filename = preg_replace( "#\x{00a0}#siu", ' ', $filename );
    20072007        }
    20082008
     2009        $filename = str_replace( array( '%20', '+' ), '-', $filename );
     2010
    20092011        /**
    20102012         * Filters the list of characters to remove from a filename.
    20112013         *
    function sanitize_file_name( $filename ) { 
    20172019        $special_chars = apply_filters( 'sanitize_file_name_chars', $special_chars, $filename_raw );
    20182020
    20192021        $filename = str_replace( $special_chars, '', $filename );
    2020         $filename = str_replace( array( '%20', '+' ), '-', $filename );
    20212022        $filename = preg_replace( '/[\r\n\t -]+/', '-', $filename );
    20222023        $filename = trim( $filename, '.-_' );
    20232024