403 error using put_blob (WAZ::Blobs::Container::store) method #32

Closed
gabpaquin opened this Issue Mar 28, 2013 · 4 comments

Projects

None yet

3 participants

@gabpaquin
Contributor

If I tried to store content on the azure blobs storage I am getting a 403 error if I tried to do the following:

test =File.read("/Users/gabriel/code/npathway/r8_image/2005_May_second/p13a.png")
my_container = WAZ::Blobs::Container::find("images")
my_container.store("2005_may_p15",test,"image/png")

However if I do the following:

my_container = WAZ::Blobs::Container::find("images")
my_container.store("2005_may_p15","simple string","application/octet-stream")

I don't get the 403 error.

@smarx
Contributor
smarx commented Mar 28, 2013

Try this:

open('/Users/gabriel/code/npathway/r8_image/2005_May_second/p13a.png', 'rb') do |f|
    container.store('2005_may_p15', f.read, 'image/png')
end

I haven't tested it, but I think the fix for the underlying bug is to use payload.bytesize instead of payload.size in SharedKeyCoreService::generate_request. I'll give it a try and submit a pull request if I'm right.

@johnnyhalife
Owner

please.

On Thu, Mar 28, 2013 at 5:27 PM, Steve Marx notifications@github.comwrote:

Try this:

open('/Users/gabriel/code/npathway/r8_image/2005_May_second/p13a.png', 'rb') do |f|
container.store('2005_may_p15', f.read, 'image/png')end

I haven't tested it, but I think the fix for the underlying bug is to
use payload.bytesize instead of payload.size in
SharedKeyCoreService::generate_request. I'll give it a try and submit a
pull request if I'm right.


Reply to this email directly or view it on GitHubhttps://github.com/johnnyhalife/waz-storage/issues/32#issuecomment-15612417
.

@smarx
Contributor
smarx commented Mar 28, 2013

I did some minimal testing (basically just @Gabey's code above), and the fix in the pull request seems to work, in that I don't receive a 403 error.

@gabpaquin
Contributor

That works pretty well! thanks @smarx

@gabpaquin gabpaquin closed this Mar 28, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment