embedly 1.4.1 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
data/ChangeLog CHANGED
@@ -1,3 +1,8 @@
1
+ *embedly-1.5.0 (22 Nov 2011)
2
+
3
+ 22 Nov 2011: Russ Bradberry <rbradberry@gmail.com>
4
+ Adds URL length check
5
+
1
6
  *embedly-1.4.1 (17 Nov 2011)
2
7
 
3
8
  17 Nov 2011: Bob Corsaro <bob@embed.ly>
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.4.1
1
+ 1.5.0
@@ -78,3 +78,14 @@ Feature: OEmbed
78
78
  | http://www.youtube.com/watch/a/bassd/url,http://www.youtube.com/watch/ldf/asdlfj | 404,404 | error,error |
79
79
  | http://www.youtube.com/watch/zzzzasdf/kl,http://yfrog.com/h7qqespj | 404, | error,photo |
80
80
  | http://yfrog.com/h7qqespj,http://www.youtube.com/watch/asdfasdfasdf | ,404 | photo,error |
81
+
82
+ Scenario Outline: Attempt to get 414 URL
83
+ Given an embedly api with key
84
+ When oembed is called with the <url> URL
85
+ Then type should be error
86
+ And error_code should be 414
87
+ And type should be error
88
+
89
+ Examples:
90
+ | url |
91
+ | http://www.youtube.com/watch/is/a/bad/url/because/it/is/longer/than/2048/characters/this/is/much/too/long/for/a/url/and/shouldnt/even/be/sent/to/the/server/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa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aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
data/lib/embedly/api.rb CHANGED
@@ -120,17 +120,24 @@ class Embedly::API
120
120
 
121
121
  # store unsupported services as errors and don't send them to embedly
122
122
  rejects = []
123
- if not key
124
- params[:urls].reject!.with_index do |url, i|
125
- if url !~ services_regex
126
- rejects << [i,
127
- Embedly::EmbedlyObject.new(
128
- :type => 'error',
129
- :error_code => 401,
130
- :error_message => 'Embedly api key is required.'
131
- )
132
- ]
133
- end
123
+
124
+ params[:urls].reject!.with_index do |url, i|
125
+ if !key && url !~ services_regex
126
+ rejects << [i,
127
+ Embedly::EmbedlyObject.new(
128
+ :type => 'error',
129
+ :error_code => 401,
130
+ :error_message => 'Embedly api key is required.'
131
+ )
132
+ ]
133
+ elsif url.length > 2048
134
+ rejects << [i,
135
+ Embedly::EmbedlyObject.new(
136
+ :type => 'error',
137
+ :error_code => 414,
138
+ :error_message => 'URL too long.'
139
+ )
140
+ ]
134
141
  end
135
142
  end
136
143
 
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: embedly
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.4.1
5
+ version: 1.5.0
6
6
  platform: ruby
7
7
  authors:
8
8
  - Bob Corsaro
@@ -13,7 +13,7 @@ autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
15
 
16
- date: 2011-11-17 00:00:00 Z
16
+ date: 2011-11-22 00:00:00 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: querystring
@@ -165,7 +165,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
165
165
  requirements:
166
166
  - - ">="
167
167
  - !ruby/object:Gem::Version
168
- hash: -1210268243539130133
168
+ hash: 2804359751864908164
169
169
  segments:
170
170
  - 0
171
171
  version: "0"