lib/auto-ali-cdn/oss.rb in 2cdn-0.1.6 vs lib/auto-ali-cdn/oss.rb in 2cdn-0.1.7
- old
+ new
@@ -68,10 +68,10 @@
file_path = res_path+"/#{name}"
file_md5 = Digest::MD5.hexdigest(File.read(file_path))
res_type = res_path.gsub(/^.*\//, '')
suffix = "."+name.split(/\./).last
new_name = rename ? name.gsub(/#{suffix}$/, "-#{file_md5}#{suffix}"): name
- object_key = config.site_resource_path+"/#{res_type}/#{new_name}"
+ object_key = config.site_resource_path+"/#{Time.now.strftime("%F %H:%M")}/#{new_name}"
if bucket.object_exists?(object_key)
puts "#{name} --> #{object_key}".color(:dimgray)
replace_res_path.call(res_type+'/'+name, config.domain_name+'/'+object_key)
else
bucket.put_object(object_key, :file => file_path)