Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

blob download using the ruby azure-storage gem is failing due to 'unknown encoding name' ArgumentError #49

Closed
JoeNunnelley opened this issue Sep 6, 2016 · 2 comments

Comments

@JoeNunnelley
Copy link

here is what I am doing

blob service initialization

Azure::Storage::setup(:storage_account_name => @account_name, 
                      :storage_access_key => @access_key)
@blob_service = Azure::Storage::Blob::BlobService.new

...

attempt to download a blob where the deconstructed[:blob_name] is the name of the blob.

blob_factual,` content = @blob_service.get_blob(container_name, deconstructed[:blob_name], { :timeout => timeout })
File.open("#{deconstructed[:target_dir]}/#{deconstructed[:blob_name]}", "wb") { |f| f.write(content) }

I hit the following error:

WARN: Unable to download: 00094811-D064-41D1-9F98-5BF3C24F05FC due to argument error.
unknown encoding name - application/octet-stream
/usr/local/var/rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/azure-storage-0.11.0.preview/lib/azure/storage/blob/blob_service.rb:63:in force_encoding'\n/usr/local/var/rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/azure-storage-0.11.0.preview/lib/azure/storage/blob/blob_service.rb:63:incall'\n/usr/local/var/rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/azure-storage-0.11.0.preview/lib/azure/storage/blob/blob.rb:89:in get_blob'\nmove_blobs_azure.rb:63:indownload_blob'\nmove_blobs_azure.rb:49:in block in get_blobs_from_container'\nmove_blobs_azure.rb:45:ineach'\nmove_blobs_azure.rb:45:in get_blobs_from_container'\nmove_blobs_azure.rb:138:inblock in

'\nmove_blobs_azure.rb:135:in each'\nmove_blobs_azure.rb:135:in'

it appears to be failing at a call to .force_encoding(...)

@yaxia
Copy link
Member

yaxia commented Sep 7, 2016

It looks the value in the response.headers['content-encoding'] header is application/octet-stream which is a content-type value. It is not supposed to happen. I will dig more on the root cause.

@yaxia
Copy link
Member

yaxia commented Sep 30, 2016

I am evaluating the PR for the fix: #52. Stay tuned~

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants