Support » Plugin: Media File Renamer » File sanitation in core

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Jordy Meow

    (@tigroumeow)

    Hello Paal,

    I will have a look. Basically, the function sanitize_file_name() is supposed to remove accents right? But it doesn’t on all install it seems?

    On my installs, it always remove the accents but I heard complain from my users that it doesn’t on their installs, it has always been a mystery for me :/

    The problem is all the extra characters (accents) need to be removed for all countries that have additional characters that do not fit into the English language.

    Since I am located in Norway I have Norwegian customers that upload their image files that on occasion also include the Norwegian æøå letters in them.

    I really do not know much about the function sanitize file name and how it works. But I do know that there is a trac ticket for it, and that files that have accent characters in them are still included in the file after it has been uploaded. I hope to see an automatic process that removes the accents characters from media file names.

    Your plugin works well but I have a client who has a lot of files they need to rename. Which makes the process more difficult because of the amount of images they have.

    The bottom line is… it would be great to get (media) file sanitation incorporated into core.

    Plugin Author Jordy Meow

    (@tigroumeow)

    The problem is all the extra characters (accents) need to be removed for all countries that have additional characters that do not fit into the English language.

    You really mean… removed? 🙂 Just taken out the string?

    Since I am located in Norway I have Norwegian customers that upload their image files that on occasion also include the Norwegian æøå letters in them.

    With the plugin, currently a filename such as “File with æøå.pdf” would be renamed into “file-with-aeoa-cc-8a.pdf”. It is not pretty but that’s how I do it now. That is fine for you, right?

    I hope to see an automatic process that removes the accents characters from media file names.

    WP avoids to put to many features such as this in the core because it would require additional options. Options are actually better managed through plugins to keep the core light and efficient. So basically what you request here I believe is to have those filenames renamed on upload? If the plugin does that, that would be fine?

    Removed = readjusted to other characters.

    Renaming Norwegian characters to English characters as you mention is fine.

    Filenames that contain non English characters need to be automatically renamed on upload yes.

    Btw
    The trac ticket I mentioned: https://core.trac.wordpress.org/ticket/22363
    In the Slack channel: https://wordpress.slack.com/messages/core-images/
    I asked what was needed to be looked at for the ticket.

    Reply from Marko:
    Currently the code doesn’t work as before. Breaks things and behaves differently when not using PCRE.
    First thing I want to do is split the unit tests so it runs with and without PCRE. Secondly looking at what to do with sanitize_file_name_chars. New code almost completely ignores it. Which could be fine.
    not really break things

    If your able to do some of these things for the trac ticket that would be great.
    If you have question then please join in the slack channel.

    Thanks.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘File sanitation in core’ is closed to new replies.