url_scrubber 0.7.18 → 0.7.19

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,3 @@
1
1
  module UrlScrubber
2
- VERSION = "0.7.18"
2
+ VERSION = "0.7.19"
3
3
  end
data/lib/url_scrubber.rb CHANGED
@@ -79,7 +79,7 @@ module UrlScrubber
79
79
  when :slideshare
80
80
  !!url.match(%r{^http://slideshare\.net/[\w_-]+$})
81
81
  when :flickr
82
- !!url.match(%r{^http://flickr\.com/[\w_-]+$})
82
+ !!url.match(%r{^http://flickr\.com/[\w_\@-]+$}) || !!url.match(%r{^http://flickr\.com/groups/[\w_\@\.-]+$})
83
83
  when :pinterest
84
84
  !!url.match(%r{^http://pinterest\.com/[\w_-]+$})
85
85
  when :yelp
@@ -197,13 +197,14 @@ module UrlScrubber
197
197
  end
198
198
 
199
199
  def self.sc_vimeo(url)
200
- if url.include?('vimeo.com/groups/')
200
+ if url.include?('vimeo.com/groups/')
201
201
  groups_partition = url.partition('vimeo.com/groups/')
202
- slash_partition = groups_partition[2].partition('/') if groups_partition[2] && groups_partition[2] != ""
203
- if slash_partition[2] && slash_partition[2] != ""
204
- # need to trim off the sub page stuff
205
- garbage = slash_partition[1] + slash_partition[2]
206
- url.gsub!(garbage, '')
202
+ if !groups_partition.nil? && !groups_partition[2].nil? && groups_partition[2] != ""
203
+ extraneous_slash_partition = groups_partition[2].partition('/')
204
+ if !extraneous_slash_partition.nil? && !extraneous_slash_partition[1].nil? && extraneous_slash_partition[1] != ""
205
+ # need to trim off the sub page stuff
206
+ return "http://vimeo.com/groups/" + extraneous_slash_partition[0]
207
+ end
207
208
  end
208
209
  end
209
210
  url
@@ -280,6 +281,18 @@ module UrlScrubber
280
281
  end
281
282
 
282
283
  def self.sc_flickr(url)
284
+ if url.include?('flickr.com/groups/')
285
+ groups_partition = url.partition('flickr.com/groups/')
286
+ if !groups_partition.nil? && !groups_partition[2].nil? && groups_partition[2] != ""
287
+ extraneous_slash_partition = groups_partition[2].partition('/')
288
+ if !extraneous_slash_partition.nil? && !extraneous_slash_partition[1].nil? && extraneous_slash_partition[1] != ""
289
+ # need to trim off the sub page stuff
290
+ return "http://flickr.com/groups/" + extraneous_slash_partition[0]
291
+ else
292
+ return url
293
+ end
294
+ end
295
+ end
283
296
  user_match = url.match(%r{flickr\.com/(photos/|people/)?([^/]+)})
284
297
  return url unless user_match
285
298
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: url_scrubber
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.18
4
+ version: 0.7.19
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2014-04-23 00:00:00.000000000 Z
15
+ date: 2014-05-01 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: rspec