discourse/discourse — pull request #1209 by ZogStriP (2013-07-16 22:42:34+00:00)
Title: Fix s3 image uploads are being improperly pathed

Meta: [S3 image uploads being improperly pathed](http://meta.discourse.org/t/s3-image-uploads-being-improperly-pathed/8334)

There are 2 ways to reference a file on S3:

- using a subdomain: http://bucket.s3.amazonaws.com/filename.ext
- with a folder: http://s3.amazonaws.com/bucket/filename.ext

According to my tests, using subdomains is faster. But one thing I overlooked is that S3 bucket names are case-sensitive. As browsers forces lowercase subdomains, using the subdomain approach isn't viable when you want to use a bucket name with an upper case.

This changes the way Discourse generates S3 urls and makes sure it does not break with old urls.