From d8f7b48776667c27130b21d2baf746ecd5f5d302 Mon Sep 17 00:00:00 2001 From: Bryan Stenson Date: Wed, 15 Oct 2014 13:54:26 -0700 Subject: [PATCH] use the file_info() method to eliminate code duplication --- lib/openstack-swift/api.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/openstack-swift/api.rb b/lib/openstack-swift/api.rb index a9259e1..7888b79 100644 --- a/lib/openstack-swift/api.rb +++ b/lib/openstack-swift/api.rb @@ -75,9 +75,7 @@ def object_stat(url, token, container, object) # Given the container and file path a manifest is created to guide the downloads of this # splitted file def create_manifest(url, token, container, file_path) - file_name = file_path.match(/.+\/(.+?)$/)[1] - file_size = File.size(file_path) - file_mtime = File.mtime(file_path).to_f.round(2) + file_name, file_mtime, file_size = file_info(file_path) manifest_path = "#{container}_segments/#{file_name}/#{file_mtime}/#{file_size}/" res = HTTParty.put("#{url}/#{container}/#{file_name}", :headers => {