Skip to content

Commit

Permalink
Fix bug with non-existing variable in Drop.create
Browse files Browse the repository at this point in the history
When uploading a file via CloudApp::Drop.create the local variable "res"
is not initialized in case the initial request to /items/new returned an error.
  • Loading branch information
cn committed Sep 22, 2011
1 parent c24c54f commit f462053
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/cloudapp/drop.rb
Expand Up @@ -104,7 +104,7 @@ def self.create(kind, opts = {})
res = post "/items", {:body => {:items => opts}, :digest_auth => @@auth}
when :upload
r = get "/items/new", {:query => ({:item => {:private => opts[:private]}} if opts.has_key?(:private)), :digest_auth => @@auth}
return bad_response(res) unless r.ok?
return bad_response(r) unless r.ok?
res = post r['url'], Multipart.new(r['params'].merge!(:file => File.new(opts[:file]))).payload.merge!(:digest_auth => @@auth)
else
# TODO raise an error
Expand Down

0 comments on commit f462053

Please sign in to comment.