discourse_fastimage 2.0.0 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/fastimage.rb +14 -11
  3. metadata +2 -16
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 560480951f53e6ba181d39677045efc544493d0d
4
- data.tar.gz: 9643cf0faf379cfc49b068f0cb46a29f027eb7a9
3
+ metadata.gz: 0dd97a14da5787f1f82ae57afd2a8821d243d717
4
+ data.tar.gz: 4e495c390dc590639415b083e4c129136b2ef286
5
5
  SHA512:
6
- metadata.gz: 29ec6c64ddb6f59d22c7a22ed5b0777095b5338cc9938fc53a58f2b6e66db92680e04f59a6b737a46133935285a1495d6fa42c484a22742e361f90c57e97592f
7
- data.tar.gz: d64ce2e11be02ff4c4849ecf30ba0ee7d1d9c0c293e19351f3600669f945bff5fb8479e05901aa8e16aadd1614d7903e4be692e2d73994fddacf9f80125c7fc3
6
+ metadata.gz: 4fcce40e46e85175d796c1eccd02db987ac20b105aea3ddd4a3dca044283ecdb3b26246cfbaf59698c1a9da87e029fe7dda33a5a5d95d12b1b5a2f71908df64b
7
+ data.tar.gz: c31bb94ab9259551018c63f393e76939ebabaf8025b7996659436b84a454a5004c55d3e7ac1f912a1118460d5bfac4b7f14394945cf4b8d31d13ff492b37e943
@@ -222,10 +222,11 @@ class FastImage
222
222
 
223
223
  raise SizeNotFound if @options[:raise_on_failure] && @property == :size && !@size
224
224
 
225
- rescue Timeout::Error, SocketError, Errno::ECONNREFUSED, Errno::EHOSTUNREACH, Errno::ECONNRESET,
226
- ImageFetchFailure, Net::HTTPBadResponse, EOFError, Errno::ENOENT, IOError
227
- raise ImageFetchFailure if @options[:raise_on_failure]
228
- rescue NoMethodError # 1.8.7p248 can raise this due to a net/http bug
225
+ rescue Timeout::Error,
226
+ Errno::ECONNREFUSED, Errno::EHOSTUNREACH, Errno::ECONNRESET, Errno::ENOENT,
227
+ Net::HTTPBadResponse,
228
+ SocketError, EOFError, IOError, NoMethodError,
229
+ ImageFetchFailure
229
230
  raise ImageFetchFailure if @options[:raise_on_failure]
230
231
  rescue UnknownImageType
231
232
  raise UnknownImageType if @options[:raise_on_failure]
@@ -476,11 +477,13 @@ class FastImage
476
477
  when "<s"
477
478
  :svg
478
479
  when "<?"
479
- if @stream.peek(100).include?("<svg")
480
- :svg
481
- else
482
- raise UnknownImageType
483
- end
480
+ first_100_characters = @stream.peek(100) rescue nil
481
+ return :svg if first_100_characters && first_100_characters.include?("<svg")
482
+
483
+ next_100_characters = @stream.peek(100) rescue nil
484
+ return :svg if next_100_characters && next_100_characters.include?("<svg")
485
+
486
+ raise UnknownImageType
484
487
  else
485
488
  raise UnknownImageType
486
489
  end
@@ -710,12 +713,12 @@ class FastImage
710
713
  values = attr_value.split(/\s/)
711
714
  @ratio = values[2].to_f / values[3].to_f
712
715
  end
713
- when /\w/
716
+ when /[<\w]/
714
717
  attr_name << char
715
718
  when ">"
716
719
  state = :stop if state == :started
717
720
  else
718
- state = :started if attr_name.join == "svg"
721
+ state = :started if attr_name.join == "<svg"
719
722
  attr_name.clear
720
723
  end
721
724
  end
metadata CHANGED
@@ -1,29 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: discourse_fastimage
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephen Sykes
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-03 00:00:00.000000000 Z
11
+ date: 2016-06-06 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: addressable
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '2'
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: '2'
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: fakeweb
29
15
  requirement: !ruby/object:Gem::Requirement