Categories
General

S3 doesn’t like plus in filenames

Exporting my media library files to S3 with W3 Total Cache has gone mostly smoothly, with one exception – S3 replaces plus signs in filenames with the urlencoded equivalent, breaking links on the blog that still expect the plus sign in the filename.

I know what you’re thinking – “Who puts a plus in a filename??” Well, over on the family blog anything is possible! I was surprised that WP’s sanitize_file_name even allows plus signs, but it does have a convenient filter to add to the list of characters to sanitize – sanitize_file_name_chars. So, I wrote a quick plugin to add a plus sign to the list: sanitizeplus.0.1.zip