url_scrubber 0.8.2 → 0.8.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZDlkYzlmMDBiOTY5MzU0N2ExYTZjMjI4YzUyZDQ0MzFiZWNiYmM1NA==
4
+ ZWNmYjEyOTYxNjVmMGI4Mjg5ODVjMzc1ZjQ3ZmMwODA1NmYxZTMwNg==
5
5
  data.tar.gz: !binary |-
6
- Y2NiYzUzMDAwZWRlZjA3MTYzZmM5ZTI2MjkyNDI2ZmQ3ZjRhMzcyMg==
6
+ N2Y4NzNkMWZkMWNlMjA4M2M2Y2QxZmQ0MWFmYTg0NzRlN2UxNmI3ZA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NTIyOGY2ZTc3YTNiMDQwMmE5NzNiZDhlOWMxMTcyYThhZDBmMTBhNDAxNTc5
10
- MTIzM2RiMzVmM2E4ZTJmMDBlNjdjNmM2MDJiNWZhMWJjZjM0MDE5NjNlNTQ3
11
- ZmFiYWYwYjJiNDRlMDg0MWUxMTdhNmY3MjdjYmQ2ZjI0YWFlNmQ=
9
+ ZGY3NmVkOTBmNjI5ZDUzYmEwZDE2OTcwZWU2ZDM2YTJjMzI2NzQwYzNhMzdm
10
+ MTIyNzUwNTY0M2Q3ODI0MzZlZWJhOGQ0M2Y4MzE0MWQ4ZjA4YjliZjIxZDdh
11
+ MTZkNTM3YjNiN2U0NWViMmNjZTViOTBlN2E5NGVkNjkzNTQyZDI=
12
12
  data.tar.gz: !binary |-
13
- YTQwYmIwMGYzOGU2ZGZjOTA1NGE3MTNkNDk4NGMzNDkyOTBlMmM3MWFjYTRi
14
- ODdhMDhjNmM0ZTIwYWY3MzZkY2UyMjQ2N2I4YThjNDQ1OGFkMDFlODU1OTU5
15
- NTY2YzQxNzk0ZTk0MTE5ZTdlZGY2MzNmY2VlNTg4NTA5NTA3ZmY=
13
+ YmExM2U0NjY4YzM1ZmY3ZTU2MmU0ZTdiNmY5ZDU5YzQ5ZWI4MWM1YWUwNjM0
14
+ NmY2Y2Q5MDgwNWVjYWQ0Yzk5OTFmMWY3Nzg2MmYyZGExZWFkMzQ5NThmMjhm
15
+ YzQ4YTY3ZDdkYjgwZGZkMzM5Y2U0ODMwNWFiNzM3NzY4MmFhZjk=
@@ -1,3 +1,3 @@
1
1
  module UrlScrubber
2
- VERSION = "0.8.2"
2
+ VERSION = "0.8.3"
3
3
  end
data/lib/url_scrubber.rb CHANGED
@@ -22,7 +22,7 @@ module UrlScrubber
22
22
  remove_www!(url)
23
23
  remove_html_tags!(url)
24
24
  url = drop_anchor!(special_cases(url))
25
- url.chomp(',')
25
+ url.sub!(/,+$/, "") # remove one or more trailing commas at the end of the URL
26
26
  url.gsub!(/\/+$/, '') # remove any trailing slashes (/) in the resulting URL
27
27
  return url
28
28
  end
@@ -198,7 +198,9 @@ module UrlScrubber
198
198
  end
199
199
 
200
200
  def self.sc_youtube(url)
201
- url.sub!('youtube.com/user/', 'youtube.com/')
201
+ # We need to allow the /user version of the URL due to how YouTube allows users to have their own URL
202
+ # which is not separate channel with it's own customUrl.
203
+ # url.sub!('youtube.com/user/', 'youtube.com/')
202
204
  url.sub!('youtube.com/profile?user=', 'youtube.com/')
203
205
  url
204
206
  end
@@ -32,8 +32,8 @@ describe UrlScrubber do
32
32
 
33
33
 
34
34
  describe 'with youtube urls' do
35
- it 'should drop /user/ if it exists' do
36
- UrlScrubber.scrub('http://youtube.com/user/absolutely').should eq('http://youtube.com/absolutely')
35
+ it 'should NOT drop /user/ if it exists' do
36
+ UrlScrubber.scrub('http://youtube.com/user/absolutely').should eq('http://youtube.com/user/absolutely')
37
37
  end
38
38
 
39
39
  it 'should handle /profile?user= urls' do
@@ -41,7 +41,7 @@ describe UrlScrubber do
41
41
  end
42
42
 
43
43
  it 'should not kick in for a non-youtube url' do
44
- UrlScrubber.scrub('http://example.com/user/absolutely').should_not eq('http://example.com/absolutely')
44
+ UrlScrubber.scrub('http://example.com/profile?user=absolutely').should_not eq('http://example.com/absolutely')
45
45
  end
46
46
  end
47
47
 
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.8.2
4
+ version: 0.8.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Colin Langton
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2016-09-26 00:00:00.000000000 Z
14
+ date: 2016-12-03 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rspec
@@ -124,7 +124,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
124
124
  version: '0'
125
125
  requirements: []
126
126
  rubyforge_project:
127
- rubygems_version: 2.6.6
127
+ rubygems_version: 2.4.8
128
128
  signing_key:
129
129
  specification_version: 4
130
130
  summary: Clean up URLs.