Skip to content

Commit

Permalink
Remove control, separator and other special characters from filename
Browse files Browse the repository at this point in the history
  • Loading branch information
takayukister committed Dec 17, 2020
1 parent fb8e297 commit 2e45060
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions includes/formatting.php
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,8 @@ function wpcf7_is_email_in_site_domain( $email ) {

function wpcf7_antiscript_file_name( $filename ) {
$filename = wp_basename( $filename );
$filename = preg_replace( '/[\pC\pZ]+/i', '', $filename );

$parts = explode( '.', $filename );

if ( count( $parts ) < 2 ) {
Expand Down

1 comment on commit 2e45060

@joidru
Copy link

@joidru joidru commented on 2e45060 Feb 2, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem with the Cyrillic alphabet, after this change and execution by the function wp_unique_filename(), the names look like this "ndhundhdhndh".

Проблема с кириллицей, после этого изменения и выполнения функции wp_unique_filename(), имена файлов выглядят примерно так "ndhundhdhndh".

Please sign in to comment.