thoughtbot/paperclip — pull request #1228 by printercu (2013-04-30 12:18:44+00:00)
Title: Ability to set custom filename sanitizers

I wanted to specify custom sanitizer that mess with long filenames. Also it's useful when subdirs in filename are allowed:
```ruby
has_attached_file :avatar,
restricted_characters: /[&$+,:;=?@<>\[\]\{\}\|\\\^~%# ]/,
filename_sanitizer: ->(str, attachment) {
attachment.cleanup_filename Pathname.new(str).cleanpath.to_s.gsub('../', '')
}
```