image_info 1.1.1 → 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0e64be805d1d84727d771133650ff254e7b8cb66
4
- data.tar.gz: 330145b1fb6c7fe6c5916de26dcac0a284240e31
3
+ metadata.gz: bc41310509a4e3d07a8e9a671875674e532f5e99
4
+ data.tar.gz: 8323109506dd885913623e9505dd5c51bddb0e51
5
5
  SHA512:
6
- metadata.gz: 4025152ff395c4a4abb50c1f8715fe80b9ac81ed0e02a8b987c010349241d9da2879927eaf29bc1b4b9efae0cceed58acab6a63754fffe4314b77687c451dc5c
7
- data.tar.gz: 1576e24fa6630e7168be36b915e74b93575155a54a50dcc1d99cc33d7fd9cb8ef295d1e39e05e421e0da6477831e7944ff5021719b984fbd68bc4313341fdfcb
6
+ metadata.gz: 46b4ddbece7f0a43cda5731cfddc80479112faec2cf7e1cdcdfb83a27f43092cd45634d2581eff2816f2bc85f78db6490e900745edef5d2ed1ab51f1e77d2320
7
+ data.tar.gz: 1551bf0913c31c88830b387b10c603c3ef0858add6f0a213f1222cc1fb6185f14f05b7c0b79911e2d5e197801e4e5f903b83ea0130820adb51584f686357899c
data/CHANGELOG.md CHANGED
@@ -1,10 +1,14 @@
1
+ * 1.1.2
2
+
3
+ - Fix issues with schemaless uri (ex: `//foo.com`)
4
+
1
5
  * 1.1.1
2
6
 
3
7
  Now only fetch partial image data to compute its size and type.
4
8
 
5
9
  Thanks to [vdaubry](https://github.com/vdaubry) the gem now uses typhoeus
6
10
  stream capability to fetch images and get its size and type, aborting the
7
- request if necessary. Make sure to use typhoeus `v0.7.3` in order to benefit
11
+ request if necessary. Make sure to use typhoeus `>= 0.7.3` in order to benefit
8
12
  from this update since there was an issue with previous typhoeus version when
9
13
  aborting ongoing requests.
10
14
 
@@ -7,7 +7,11 @@ module ImageInfo
7
7
  attr_accessor :width, :height, :type
8
8
 
9
9
  def initialize(uri)
10
- @uri = ::URI.parse(::URI.encode(uri.to_s))
10
+ @uri = ::URI.parse(::URI.encode(uri.to_s))
11
+ @uri.scheme = 'http' unless @uri.scheme
12
+ @uri.port = 80 unless @uri.port
13
+ rescue ::URI::InvalidURIError
14
+ @uri = NullUri.new
11
15
  end
12
16
 
13
17
  def size
@@ -15,7 +19,14 @@ module ImageInfo
15
19
  end
16
20
 
17
21
  def valid?
18
- uri.is_a?(::URI::HTTP)
22
+ !!uri.host
23
+ end
24
+
25
+ private
26
+
27
+ class NullUri
28
+ def host
29
+ end
19
30
  end
20
31
 
21
32
  end
@@ -1,3 +1,3 @@
1
1
  module ImageInfo
2
- VERSION = '1.1.1'
2
+ VERSION = '1.1.2'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: image_info
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pierre-Louis Gottfrois
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-08-11 00:00:00.000000000 Z
11
+ date: 2015-08-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: typhoeus