bea-sanitize-filename
bea-sanitize-filename copied to clipboard
Accented characters are completely removed
Version information
- Plugin version : 2.0.6
- PHP : 7.2
- WordPress : 4.9.8
Steps to reproduce
- Upload a file with a name which contains an accented character like
noël.jpg
What was expected
The file renamed to noel.jpg
What happened instead
The file renamed to nol.jpg
The problem is appeared on v2.0.6 and I think it is comes from https://github.com/BeAPI/bea-sanitize-filename/commit/54a09444afe0407844fe99776d7750ec7e719c9d commit.
I added comments on https://github.com/BeAPI/bea-sanitize-filename/commit/54a09444afe0407844fe99776d7750ec7e719c9d
Thank you @ajoah for the report.
I've been digging into this. It seems that a file
noël.jpgis not working with version 2.0.5 nor 2.0.6.
Here what happens for me :
I will be looking soon this strange issue a little bit more. Thx
Indeed strange... From my tests, v2.0.5 works well.. (I am on Windows 10) Tested on my websites and on an online sandbox with only the plugin installed.
I have done others tests and it has always failed with the accentuated ë
, formatted from a mac, because the encoding format is stored into the filename attributes unlike other filesystem.
I need to check http://php.net/manual/fr/function.utf8-encode.php to see what I can get. More info about file system : http://php.net/manual/en/function.stat.php
Hi @MaximeCulea
I did some tests and sorry but i don't understand the purpose of this commit : https://github.com/BeAPI/bea-sanitize-filename/commit/54a09444afe0407844fe99776d7750ec7e719c9d (added on bea-sanitize-filename v2.0.6)
What issue do this commit fixes?
I created a file on Mac OS Sierra Virtual machine with bea-sanitize-filename v2.0.5 : ÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÒÓÔÕÖÙÚÛÜÝàáâãäåçèéêëìíîïðòóôõöùúûüýÿ.jpg
(The same characters as those added in the commit)
I have uploaded it to WP.
Result : aaaaaaceeeeiiiiooooouuuuyaaaaaaceeeeiiiidooooouuuuyy.jpg
(Tested on a poopy.life
sandbox with only your plugin installed. (v2.0.5))
Except the ð
transformed in d
, it is perfect 👍
On v2.0.6, all theses characters are deleted, result : unnamed-file.jpg