fastimage 1.2.6 → 1.2.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/fastimage.rb +9 -4
  2. data/test/test.rb +6 -0
  3. metadata +9 -4
data/lib/fastimage.rb CHANGED
@@ -136,11 +136,16 @@ class FastImage
136
136
  @property = options[:type_only] ? :type : :size
137
137
  @timeout = options[:timeout] || DefaultTimeout
138
138
  @uri = uri
139
- @parsed_uri = URI.parse(uri)
140
- if @parsed_uri.scheme == "http" || @parsed_uri.scheme == "https"
141
- fetch_using_http
142
- else
139
+ begin
140
+ @parsed_uri = URI.parse(uri)
141
+ rescue URI::InvalidURIError
143
142
  fetch_using_open_uri
143
+ else
144
+ if @parsed_uri.scheme == "http" || @parsed_uri.scheme == "https"
145
+ fetch_using_http
146
+ else
147
+ fetch_using_open_uri
148
+ end
144
149
  end
145
150
  raise SizeNotFound if options[:raise_on_failure] && @property == :size && !@size
146
151
  rescue Timeout::Error, SocketError, Errno::ECONNREFUSED, Errno::EHOSTUNREACH, Errno::ECONNRESET,
data/test/test.rb CHANGED
@@ -98,6 +98,12 @@ class FastImageTest < Test::Unit::TestCase
98
98
  assert_equal info[1], FastImage.size(File.join(FixturePath, fn))
99
99
  end
100
100
  end
101
+
102
+ def test_should_report_size_correctly_for_local_files_with_path_that_has_spaces
103
+ Dir.chdir(PathHere) do
104
+ assert_equal GoodFixtures["test.bmp"][1], FastImage.size(File.join("fixtures", "folder with spaces", "test.bmp"))
105
+ end
106
+ end
101
107
 
102
108
  def test_should_return_nil_on_fetch_failure_for_local_path
103
109
  assert_nil FastImage.size("does_not_exist")
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastimage
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 17
4
5
  prerelease: false
5
6
  segments:
6
7
  - 1
7
8
  - 2
8
- - 6
9
- version: 1.2.6
9
+ - 7
10
+ version: 1.2.7
10
11
  platform: ruby
11
12
  authors:
12
13
  - Stephen Sykes
@@ -14,7 +15,7 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2010-05-08 00:00:00 +03:00
18
+ date: 2010-07-14 00:00:00 +03:00
18
19
  default_executable:
19
20
  dependencies: []
20
21
 
@@ -51,23 +52,27 @@ rdoc_options:
51
52
  require_paths:
52
53
  - lib
53
54
  required_ruby_version: !ruby/object:Gem::Requirement
55
+ none: false
54
56
  requirements:
55
57
  - - ">="
56
58
  - !ruby/object:Gem::Version
59
+ hash: 3
57
60
  segments:
58
61
  - 0
59
62
  version: "0"
60
63
  required_rubygems_version: !ruby/object:Gem::Requirement
64
+ none: false
61
65
  requirements:
62
66
  - - ">="
63
67
  - !ruby/object:Gem::Version
68
+ hash: 3
64
69
  segments:
65
70
  - 0
66
71
  version: "0"
67
72
  requirements: []
68
73
 
69
74
  rubyforge_project:
70
- rubygems_version: 1.3.6
75
+ rubygems_version: 1.3.7
71
76
  signing_key:
72
77
  specification_version: 3
73
78
  summary: FastImage - Image info fast