down 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -3
- data/down.gemspec +1 -1
- data/lib/down.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 595622550e0149614c790453bc98f4f2942cc2a7
|
4
|
+
data.tar.gz: f15b3f0295b7e7b5ca4f7e6e8378b756491c1f4d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1e8061c128db991dc07f8217053873a4dc8eba846c51ecd9c942f6019d3692a0e3c7b4e4e2b18ada1d6063ee3ce42782d4e9d1d19bcfa3ce44adfa5f087a3d65
|
7
|
+
data.tar.gz: 58567888d34a9147a297f295f7e558783fc9a449b37af8d62118003126ae42f1aac531c40c141b58262c1e3240b8bb88a2a846524554a7167817be0aaa4aad57
|
data/README.md
CHANGED
@@ -15,13 +15,13 @@ enough to just use `open-uri`. However, if you're accepting URLs from your
|
|
15
15
|
users (e.g. through `remote_<avatar>_url` in CarrierWave), then downloading is
|
16
16
|
suddenly not as simple as it appears to be.
|
17
17
|
|
18
|
-
###
|
18
|
+
### StringIO
|
19
19
|
|
20
20
|
Firstly, you may think that `open-uri` always downloads a file to disk, but
|
21
21
|
that's not true. If the downloaded file has 10 KB or less, `open-uri` actually
|
22
22
|
returns a `StringIO`. In my application I needed that the file is always
|
23
|
-
downloaded to disk. This
|
24
|
-
behaviour and always returns a `Tempfile`.
|
23
|
+
downloaded to disk. This was obviously a wrong design decision from the MRI
|
24
|
+
team, so Down patches this behaviour and always returns a `Tempfile`.
|
25
25
|
|
26
26
|
### Metadata
|
27
27
|
|
data/down.gemspec
CHANGED
data/lib/down.rb
CHANGED
@@ -22,6 +22,7 @@ module Down
|
|
22
22
|
options[:progress].call(current_size) if options[:progress]
|
23
23
|
},
|
24
24
|
open_timeout: options[:timeout],
|
25
|
+
redirect: false,
|
25
26
|
)
|
26
27
|
|
27
28
|
# open-uri will return a StringIO instead of a Tempfile if the filesize
|
@@ -36,7 +37,6 @@ module Down
|
|
36
37
|
downloaded_file
|
37
38
|
|
38
39
|
rescue => error
|
39
|
-
raise if error.instance_of?(RuntimeError) && error.message !~ /redirection/
|
40
40
|
raise if error.is_a?(Down::Error)
|
41
41
|
raise Down::NotFound, error.message
|
42
42
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: down
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Janko Marohnić
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-09-
|
11
|
+
date: 2015-09-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|