Recently I had a problem while serving dynamic content in a Spring MVC application; (more details here) when attempting to open some of the dynamic content with Chrome I was having a weird error message :
I wasn't sure why I was having this problem, since some dynamic content was working properly and I was setting only once the Content-Disposition header on my code
So after searching around a bit I stumbled upon the HTTP specs it turns out the Content-Disposition header should not contain a coma since it will be treated as a header separator
Personally I decided to create slugs for all my file names using the Slugify library :
com.github.slugify slugify 2.1.3
public String slugify(String originalFileName){ String extension = FilenameUtils.getExtension(originalFileName); return new Slugify(true).slugify(FilenameUtils.removeExtension(originalFileName)) +"."+extension;; }