Paperclip - How to control which characters are escaped / underlined in the uploaded file name?

In a recent update to the paperclip clip, I noticed that uploaded file names change and some characters change to an underscore.

I don't like the fact that it changes spaces to underscores. What is wrong with the space in the file name? 90 are long.

+3
source share
1 answer

After some digging, I found this undocumented option for has_attached_file:

:restricted_characters

The default value of this parameter is as follows:

:restricted_characters => /[&$+,\/:;=?@<>\[\]\{\}\|\\\^~%# ]/,

The last is a gap. Remove it and you are good.

+9
source

All Articles