From a584d8f7e9fee019419acfa2fb0351ad08ffd855 Mon Sep 17 00:00:00 2001 From: Kyle Rames Date: Fri, 31 May 2013 15:28:13 -0500 Subject: [PATCH] [rackspace|storage] fixing large upload example and documentation --- lib/fog/rackspace/docs/storage.md | 4 ++-- lib/fog/rackspace/examples/storage/upload_large_files.rb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/fog/rackspace/docs/storage.md b/lib/fog/rackspace/docs/storage.md index 99c5069d9..6f9b63feb 100644 --- a/lib/fog/rackspace/docs/storage.md +++ b/lib/fog/rackspace/docs/storage.md @@ -382,8 +382,8 @@ Cloud Files requires files larger than 5 GB to be uploaded into segments along w read = 0 # upload segment to cloud files service.put_object("my_container", "large_file/#{segment}", nil, options = {}) do - if (offset < SEGMENT_LIMIT) && (read.zero? || read == BUFFER_SIZE) - buf = f.sysread(BUFFER_SIZE) + if (offset < SEGMENT_LIMIT) && !f.eof? + buf = f.read(BUFFER_SIZE) read = buf.size offset += read buf diff --git a/lib/fog/rackspace/examples/storage/upload_large_files.rb b/lib/fog/rackspace/examples/storage/upload_large_files.rb index 270d414bb..33443feef 100644 --- a/lib/fog/rackspace/examples/storage/upload_large_files.rb +++ b/lib/fog/rackspace/examples/storage/upload_large_files.rb @@ -69,9 +69,9 @@ File.open(file_name) do |f| offset = 0 read = 0 service.put_object(directory.key, "#{segment_name}/#{segment}", nil, options = {}) do - if (offset < SEGMENT_LIMIT) && (read.zero? || read == BUFFER_SIZE) + if (offset < SEGMENT_LIMIT) && !f.eof? print "." - buf = f.sysread(BUFFER_SIZE) + buf = f.read(BUFFER_SIZE) read = buf.size offset += read buf