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

fix 1.8.7 error, oops

This commit is contained in:
Andrew Kuklewicz 2013-03-06 14:18:40 -06:00
parent 36e61c91fa
commit 8b65626047

View file

@ -36,15 +36,15 @@ module Fog
def set_metadata_array_headers(array_attribute, options={})
attr_values = Array(self.send(array_attribute))
opt_values = options.collect do |key,value|
options.delete(key) if (key.to_s =~ /^x-(amz||archive)-meta(\d*)-#{array_attribute[0..-2]}/)
options.delete(key) if (key.to_s =~ /^x-(amz||archive)-meta(\d*)-#{array_attribute.to_s[0..-2]}/)
end
values = (attr_values + opt_values).compact.sort.uniq
# got the values, now add them back to the options
if values.size == 1
options["x-archive-meta-#{array_attribute[0..-2]}"] = values.first
options["x-archive-meta-#{array_attribute.to_s[0..-2]}"] = values.first
elsif values.size > 1
values[0,99].each_with_index do |value, i|
options["x-archive-meta#{format("%02d", i+1)}-#{array_attribute[0..-2]}"] = value
options["x-archive-meta#{format("%02d", i+1)}-#{array_attribute.to_s[0..-2]}"] = value
end
end