fastimage 2.2.1 → 2.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.textile +1 -1
- data/lib/fastimage.rb +13 -11
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6e4c8a8fb1f0bf8db7dff5aef7fd640d56e0938bd0c0e8bd2f5f0a659009429d
|
4
|
+
data.tar.gz: f827ef53ce46af99612e2628f72ed5bfa2c82b4729ea3a5dccd76dc67079b6c3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 599ffa78f1020ece118a5f1bc47533ad98085ac6f71ede9ad4b2b0c1d8748c81e4fb060f6a1b9f5001f7df2661d70d9a16972bd118863461d39d491d0e3b2988
|
7
|
+
data.tar.gz: d761639e39eae059e2f810c7d6a124515d3c6db1470236044db376b424e78effaf48c51f4197c3a565c1aae3d1f742e1899e221f566a828c4f1f209d4e91d588
|
data/README.textile
CHANGED
data/lib/fastimage.rb
CHANGED
@@ -251,10 +251,8 @@ class FastImage
|
|
251
251
|
Errno::ENETUNREACH, ImageFetchFailure, Net::HTTPBadResponse, EOFError, Errno::ENOENT,
|
252
252
|
OpenSSL::SSL::SSLError
|
253
253
|
raise ImageFetchFailure if @options[:raise_on_failure]
|
254
|
-
rescue NoMethodError # 1.8.7p248 can raise this due to a net/http bug
|
255
|
-
raise ImageFetchFailure if @options[:raise_on_failure]
|
256
254
|
rescue UnknownImageType
|
257
|
-
raise
|
255
|
+
raise if @options[:raise_on_failure]
|
258
256
|
rescue CannotParseImage
|
259
257
|
if @options[:raise_on_failure]
|
260
258
|
if @property == :size
|
@@ -434,8 +432,11 @@ class FastImage
|
|
434
432
|
end
|
435
433
|
|
436
434
|
def fetch_using_base64(uri)
|
437
|
-
|
438
|
-
|
435
|
+
decoded = begin
|
436
|
+
Base64.decode64(uri.split(',')[1])
|
437
|
+
rescue
|
438
|
+
raise CannotParseImage
|
439
|
+
end
|
439
440
|
@content_length = decoded.size
|
440
441
|
fetch_using_read StringIO.new(decoded)
|
441
442
|
end
|
@@ -471,19 +472,20 @@ class FastImage
|
|
471
472
|
|
472
473
|
# Peeking beyond the end of the input will raise
|
473
474
|
def peek(n)
|
474
|
-
while @strpos + n
|
475
|
+
while @strpos + n > @str.size
|
475
476
|
unused_str = @str[@strpos..-1]
|
477
|
+
|
476
478
|
new_string = @read_fiber.resume
|
479
|
+
new_string = @read_fiber.resume if new_string.is_a? Net::ReadAdapter
|
477
480
|
raise CannotParseImage if !new_string
|
478
|
-
|
479
481
|
# we are dealing with bytes here, so force the encoding
|
480
|
-
new_string.force_encoding("ASCII-8BIT") if
|
482
|
+
new_string.force_encoding("ASCII-8BIT") if new_string.respond_to? :force_encoding
|
481
483
|
|
482
484
|
@str = unused_str + new_string
|
483
485
|
@strpos = 0
|
484
486
|
end
|
485
487
|
|
486
|
-
@str[@strpos
|
488
|
+
@str[@strpos, n]
|
487
489
|
end
|
488
490
|
|
489
491
|
def read(n)
|
@@ -501,7 +503,7 @@ class FastImage
|
|
501
503
|
new_string = @read_fiber.resume
|
502
504
|
raise CannotParseImage if !new_string
|
503
505
|
|
504
|
-
new_string.force_encoding("ASCII-8BIT") if
|
506
|
+
new_string.force_encoding("ASCII-8BIT") if new_string.respond_to? :force_encoding
|
505
507
|
|
506
508
|
fetched += new_string.size
|
507
509
|
@str = new_string
|
@@ -585,7 +587,7 @@ class FastImage
|
|
585
587
|
|
586
588
|
# fields (1) + bg color (1) + pixel ratio (1)
|
587
589
|
fields = @stream.read(3).unpack("CCC")[0]
|
588
|
-
if fields & 0x80 # Global Color Table
|
590
|
+
if fields & 0x80 != 0 # Global Color Table
|
589
591
|
# 2 * (depth + 1) colors, each occupying 3 bytes (RGB)
|
590
592
|
@stream.skip(3 * 2 ** ((fields & 0x7) + 1))
|
591
593
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fastimage
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.2.
|
4
|
+
version: 2.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stephen Sykes
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-01-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fakeweb-fi
|
@@ -81,7 +81,7 @@ homepage: http://github.com/sdsykes/fastimage
|
|
81
81
|
licenses:
|
82
82
|
- MIT
|
83
83
|
metadata: {}
|
84
|
-
post_install_message:
|
84
|
+
post_install_message:
|
85
85
|
rdoc_options:
|
86
86
|
- "--charset=UTF-8"
|
87
87
|
require_paths:
|
@@ -97,8 +97,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
97
97
|
- !ruby/object:Gem::Version
|
98
98
|
version: '0'
|
99
99
|
requirements: []
|
100
|
-
rubygems_version: 3.
|
101
|
-
signing_key:
|
100
|
+
rubygems_version: 3.2.3
|
101
|
+
signing_key:
|
102
102
|
specification_version: 4
|
103
103
|
summary: FastImage - Image info fast
|
104
104
|
test_files: []
|