WordPress.org

Make WordPress Core

Ticket #15955: Remove_Special_Chars_from_filename__first_error_.patch

File Remove_Special_Chars_from_filename__first_error_.patch, 1.0 KB (added by sebastian.pisula, 3 years ago)
  • wp-includes/formatting.php

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
     
    17721772                 * @param string $filename     Sanitized filename.
    17731773                 * @param string $filename_raw The filename prior to sanitization.
    17741774                 */
    1775                 return apply_filters( 'sanitize_file_name', $filename, $filename_raw );
     1775                return apply_filters( 'sanitize_file_name', preg_replace( "/[^a-z0-9\-.]/", "", $filename ), $filename_raw );
    17761776        }
    17771777
    17781778        // Process multiple extensions
     
    18021802        }
    18031803        $filename .= '.' . $extension;
    18041804        /** This filter is documented in wp-includes/formatting.php */
    1805         return apply_filters('sanitize_file_name', $filename, $filename_raw);
     1805        return apply_filters( 'sanitize_file_name', preg_replace( "/[^a-z0-9\-.]/", "", $filename ), $filename_raw );
    18061806}
    18071807
    18081808/**