Fix filename for private files and special chars

This fixes two problems:
- The signed url for private files can contain slashes, which broke the
  previous code
- The filename can contain url encoded characters if a non-default
  sanitization regex is used

Fix taken from fog file class in carrierwave master.