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

use CGI.escapeHTML instead of CGI.escape

CGI.escape creates URL-safe encodings, but we need XML-safe encodings.
If the key name has a "/" in it (as for a directory structure) it gets
replaced with a URL-safe "%2F" which S3 treats as a literal part of the
key name. We only need to escape the parts of the key that could result
in malformed XML.
This commit is contained in:
John Parker 2012-12-24 09:37:14 -08:00
parent 666b832232
commit 2c38747fa9

View file

@ -42,10 +42,10 @@ module Fog
version_ids = options.delete('versionId')
object_names.each do |object_name|
data << "<Object>"
data << "<Key>#{CGI.escape(object_name)}</Key>"
data << "<Key>#{CGI.escapeHTML(object_name)}</Key>"
object_version = version_ids.nil? ? nil : version_ids[object_name]
if object_version
data << "<VersionId>#{CGI.escape(object_version)}</VersionId>"
data << "<VersionId>#{CGI.escapeHTML(object_version)}</VersionId>"
end
data << "</Object>"
end