1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

Tweak to escape the Cloud Files filename before passing to public_url.

Previously, a Rackspace Cloud Files storage object with a name like
"my_files/1234/original/picture #1.jpg" would generate a public URL like:

http://c21641.r41.cf1.rackcdn.com/user_files/1313284/thumb/IMG_4034 #1.jpg

The # character in the URL would get interpreted by Cloud Files as an
anchor marker, and the file would not load.  This change does the
Fog::Rackspace.escape on the key (excluding the / path separator character)
to generate a working URL of the form:

http://c21641.r41.cf1.rackcdn.com/user_files/1313284/thumb/IMG_4034%20%231.jpg

Which is correctly interpreted by Cloud Files and pulls up.

Both of those URLs are live to demonstrate the issue.
This commit is contained in:
H. Wade Minter 2011-09-20 13:36:37 -04:00
parent 8bd540938b
commit 016d640683

View file

@ -50,7 +50,7 @@ module Fog
def public_url
requires :key
self.collection.get_url(self.key)
self.collection.get_url(Fog::Rackspace.escape(self.key, '/'))
end
def save(options = {})