dbox 0.7.3 → 0.7.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/VERSION +1 -1
  2. data/dbox.gemspec +2 -2
  3. data/lib/dbox/api.rb +8 -2
  4. metadata +4 -4
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.7.3
1
+ 0.7.4
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "dbox"
8
- s.version = "0.7.3"
8
+ s.version = "0.7.4"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Ken Pratt"]
12
- s.date = "2012-12-23"
12
+ s.date = "2013-04-10"
13
13
  s.description = "An easy-to-use Dropbox client with fine-grained control over syncs."
14
14
  s.email = "ken@kenpratt.net"
15
15
  s.executables = ["dbox"]
@@ -208,7 +208,7 @@ module Dbox
208
208
  end
209
209
  end
210
210
 
211
- def streaming_download(url, io)
211
+ def streaming_download(url, io, num_redirects = 0)
212
212
  url = URI.parse(url)
213
213
  http = Net::HTTP.new(url.host, url.port)
214
214
  http.use_ssl = true
@@ -224,7 +224,13 @@ module Dbox
224
224
  res.read_body {|chunk| io.write(chunk) }
225
225
  true
226
226
  else
227
- raise DropboxError.new("Invalid response #{res.inspect}")
227
+ if res.kind_of?(Net::HTTPRedirection) && res.header['location'] && num_redirects < 10
228
+ log.info("following redirect, num_redirects = #{num_redirects}")
229
+ log.info("redirect url: #{res.header['location']}")
230
+ streaming_download(res.header['location'], io, num_redirects + 1)
231
+ else
232
+ raise DropboxError.new("Invalid response #{res.inspect}")
233
+ end
228
234
  end
229
235
  end
230
236
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dbox
3
3
  version: !ruby/object:Gem::Version
4
- hash: 5
4
+ hash: 11
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 7
9
- - 3
10
- version: 0.7.3
9
+ - 4
10
+ version: 0.7.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Ken Pratt
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-12-23 00:00:00 Z
18
+ date: 2013-04-10 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: multipart-post