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

[local|storage] CGI.escape file names

This commit is contained in:
geemus 2010-11-23 13:45:37 -08:00
parent a063173ba9
commit 21cd346b4d
2 changed files with 17 additions and 3 deletions

View file

@ -65,7 +65,7 @@ module Fog
end
def path
connection.path_to(::File.join(directory.key, key))
connection.path_to(::File.join(directory.key, CGI.escape(key)))
end
end

View file

@ -20,7 +20,7 @@ module Fog
path = file_path(key)
{
:content_length => ::File.size(path),
:key => key,
:key => CGI.unescape(key),
:last_modified => ::File.mtime(path)
}
end
@ -32,7 +32,7 @@ module Fog
def get(key, &block)
requires :directory
path = file_path(key)
path = file_path(CGI.escape(key))
if ::File.exists?(path)
data = {
:content_length => ::File.size(path),
@ -53,6 +53,20 @@ module Fog
end
end
def head(key)
requires :directory
path = file_path(CGI.escape(key))
if ::File.exists?(path)
new({
:content_length => ::File.size(path),
:key => key,
:last_modified => ::File.mtime(path)
})
else
nil
end
end
def new(attributes = {})
requires :directory
super({ :directory => directory }.merge!(attributes))