Skip to content

Commit f738ef6

Browse files
committed
#149 Using URI::Parser
1 parent 1f91814 commit f738ef6

File tree

5 files changed

+11
-11
lines changed

5 files changed

+11
-11
lines changed

plugins/filter/absolute_uri.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
# Name:: Automatic::Plugin::Filter::AbsoluteURI
33
# Author:: 774 <http://id774.net>
44
# Created:: Jun 20, 2012
5-
# Updated:: Apr 5, 2013
6-
# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers.
5+
# Updated:: Oct 29, 2014
6+
# Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers.
77
# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
88

99
module Automatic::Plugin
@@ -37,7 +37,7 @@ def rewrite(string)
3737
@config['url'] = @config['url'] + '/'
3838
end
3939
string = @config['url'] + string.sub(/^\./,'').sub(/^\//,'')
40-
string = URI.encode(string)
40+
string = URI::Parser.new.escape(string)
4141
return string
4242
end
4343
end

plugins/subscription/g_guide.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Author:: soramugi <http://soramugi.net>
44
# 774 <http://id774.net>
55
# Created:: Jun 28, 2013
6-
# Updated:: Feb 21, 2014
6+
# Updated:: Oct 29, 2014
77
# Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers.
88
# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
99

@@ -43,7 +43,7 @@ def feed_url keyword = nil
4343
feed += "condition.keyword=#{keyword}&"
4444
end
4545
feed += station_param
46-
URI.encode(feed)
46+
URI::Parser.new.escape(feed)
4747
end
4848

4949
def station_param

plugins/subscription/link.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Name:: Automatic::Plugin::Subscription::Link
33
# Author:: 774 <http://id774.net>
44
# Created:: Sep 18, 2012
5-
# Updated:: Feb 21, 2014
5+
# Updated:: Oct 29, 2014
66
# Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers.
77
# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
88

@@ -22,7 +22,7 @@ def run
2222
retries = 0
2323
retry_max = @config['retry'].to_i || 0
2424
begin
25-
create_rss(URI.encode(url))
25+
create_rss(URI::Parser.new.escape(url))
2626
rescue
2727
retries += 1
2828
Automatic::Log.puts("error", "ErrorCount: #{retries}, Fault in parsing: #{url}")

plugins/subscription/xml.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Name:: Automatic::Plugin::Subscription::Xml
33
# Author:: 774 <http://id774.net>
44
# Created:: Jul 12, 2013
5-
# Updated:: May 16, 2014
5+
# Updated:: Oct 29, 2014
66
# Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers.
77
# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
88

@@ -25,7 +25,7 @@ def run
2525
retries = 0
2626
retry_max = @config['retry'].to_i || 0
2727
begin
28-
create_rss(URI.encode(url))
28+
create_rss(URI::Parser.new.escape(url))
2929
rescue
3030
retries += 1
3131
Automatic::Log.puts("error", "ErrorCount: #{retries}, Fault in parsing: #{url}")

spec/plugins/subscription/g_guide_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def g_guide(config = {}, pipeline = [])
2929
subject { g_guide(config) }
3030

3131
it 'feed_url' do
32-
subject.feed_url(config['keyword']).should == URI.encode(
32+
subject.feed_url(config['keyword']).should == URI::Parser.new.escape(
3333
Automatic::Plugin::SubscriptionGGuide::G_GUIDE_RSS +
3434
"condition.keyword=#{config['keyword']}&" +
3535
'stationPlatformId=0&')
@@ -40,7 +40,7 @@ def g_guide(config = {}, pipeline = [])
4040
subject { g_guide(config) }
4141

4242
its(:feed_url) {
43-
should == URI.encode(
43+
should == URI::Parser.new.escape(
4444
Automatic::Plugin::SubscriptionGGuide::G_GUIDE_RSS +
4545
'stationPlatformId=1&')
4646
}

0 commit comments

Comments
 (0)