apache_image_resizer 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/README CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  == VERSION
4
4
 
5
- This documentation refers to apache_image_resizer version 0.0.3
5
+ This documentation refers to apache_image_resizer version 0.0.4
6
6
 
7
7
 
8
8
  == DESCRIPTION
@@ -149,12 +149,11 @@ module Apache
149
149
  match, directives, max = Regexp.last_match, {}, @max_dim
150
150
 
151
151
  if o = match[3]
152
- h, *xy = match.values_at(4, 5, 6)
152
+ wh = [o.to_f, match[4].to_f]
153
+ xy = match.values_at(5, 6)
153
154
 
154
- if (args = [o.to_f, h.to_f]).all? { |i| i <= max }
155
- directives[:offset] = xy.map! { |i|
156
- i.tr!('pm', '+-').to_f
157
- }.concat(args)
155
+ if wh.all? { |i| 0 < i && i <= max }
156
+ directives[:offset] = xy.map! { |i| i.tr!('pm', '+-').to_f }.concat(wh)
158
157
  else
159
158
  return
160
159
  end
@@ -163,13 +162,13 @@ module Apache
163
162
  if w = match[1]
164
163
  h = match[2]
165
164
 
166
- args = [w.to_f]
167
- args << h.to_f if h
165
+ wh = [w.to_f]
166
+ wh << h.to_f if h
168
167
 
169
168
  max *= 2 if o
170
169
 
171
- if args.all? { |i| i <= max }
172
- directives[:resize] = args
170
+ if wh.all? { |i| 0 < i && i <= max }
171
+ directives[:resize] = wh
173
172
  else
174
173
  return
175
174
  end
@@ -6,7 +6,7 @@ module Apache
6
6
 
7
7
  MAJOR = 0
8
8
  MINOR = 0
9
- TINY = 3
9
+ TINY = 4
10
10
 
11
11
  class << self
12
12
 
@@ -44,6 +44,22 @@ describe Apache::ImageResizer do
44
44
  @uri %= 'r10000'
45
45
  end
46
46
 
47
+ it_should :decline, 'Zero width', 'Invalid Directives' do
48
+ @uri %= 'r0x100'
49
+ end
50
+
51
+ it_should :decline, 'Zero height', 'Invalid Directives' do
52
+ @uri %= 'r100x0'
53
+ end
54
+
55
+ it_should :decline, 'Zero width offset', 'Invalid Directives' do
56
+ @uri %= 'o0x100p0p0'
57
+ end
58
+
59
+ it_should :decline, 'Zero height offset', 'Invalid Directives' do
60
+ @uri %= 'o100x0p0p0'
61
+ end
62
+
47
63
  it_should :decline, 'Read Error: Magick::ImageMagickError' do
48
64
  mock_uri(path = '/source-path')
49
65
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: apache_image_resizer
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 23
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 3
10
- version: 0.0.3
9
+ - 4
10
+ version: 0.0.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jens Wille
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-11-07 00:00:00 Z
18
+ date: 2011-11-17 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: rmagick
@@ -102,7 +102,7 @@ licenses: []
102
102
  post_install_message:
103
103
  rdoc_options:
104
104
  - --title
105
- - apache_image_resizer Application documentation (v0.0.3)
105
+ - apache_image_resizer Application documentation (v0.0.4)
106
106
  - --line-numbers
107
107
  - --main
108
108
  - README