ruby-feedparser 0.9.6 → 0.9.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ef98b8e94313acaf4bb675bf288be24431c4667259cdba3c0cd8442a50a8a60d
4
- data.tar.gz: 143101e95cd72744fe963cd2a9eb925c17060a718bc06e7024f41f221b50ab97
3
+ metadata.gz: e198cf8ee7423ff4edf5ba4367ac809ba1fe2a9d6361fcf53d12b984aa138228
4
+ data.tar.gz: bbbd8c024c4e85c991ae2ceae4494e24d8b0865d2fe6a4df2646007e798e96ac
5
5
  SHA512:
6
- metadata.gz: b0ae6ccf83dc9fae3d8d0b16df210852d230c2927bccc5f94ce113e21efe51c175eb0123054183f2c63ae98b4356fdd66fee56628f9acf821c5c781f1da1763b
7
- data.tar.gz: 1a920814efea8833c9b4172b1f97b54e76b3951013820da855786dc9303058a4a306b244d62b1ac7d8023c0c48fde9a8754e38884c5e0e0b4e8c8d9714aa54ee
6
+ metadata.gz: ac90154cfa40180e03d4b7b1d631186c6db1d70d79bdbb7f4edb4c54a66eddab3085e04480ed965b7c2e055770976873224b9d12f20be3d282817d6cd34245be
7
+ data.tar.gz: 4f658dc07c1d692b44f9abd0d400449cb0e1aa3d1cda8c782b052e45b193a8ad462ce7e2d8f951b3d15b301764e651f3781da93cf07f28c1ea8438ab87a1c989
@@ -233,7 +233,11 @@ module FeedParser
233
233
 
234
234
  def link
235
235
  if @link
236
- uri = URI.parse(CGI.escape(@link))
236
+ begin
237
+ uri = URI.parse(@link)
238
+ rescue URI::InvalidURIError
239
+ return @link
240
+ end
237
241
  if uri.hostname && uri.scheme
238
242
  @link
239
243
  elsif feed && feed.origin
@@ -1,3 +1,3 @@
1
1
  module FeedParser
2
- VERSION = "0.9.6"
2
+ VERSION = "0.9.7"
3
3
  end
@@ -0,0 +1,47 @@
1
+ require 'feedparser/feedparser'
2
+ require 'test/unit'
3
+
4
+
5
+ class FeedItemTest < Test::Unit::TestCase
6
+ def setup
7
+ @item = FeedParser::FeedItem.new(nil, nil)
8
+ end
9
+
10
+ ########################################################################
11
+
12
+ def test_link_no_link
13
+ assert @item.link.nil?
14
+ end
15
+
16
+ def test_link_basic
17
+ @item.instance_variable_set('@link', 'https://www.example.com/')
18
+ assert_equal "https://www.example.com/", @item.link
19
+ end
20
+
21
+ def test_link_path_only
22
+ @item.instance_variable_set('@link', '/foo/bar/')
23
+ assert_equal "/foo/bar/", @item.link
24
+ end
25
+
26
+ def test_link_path_only_with_feed_origin
27
+ @item.instance_variable_set('@link', '/foo/bar/')
28
+ feed = FeedParser::Feed.new
29
+ feed.instance_variable_set('@origin', 'https://www.exampleorigin.com')
30
+ @item.instance_variable_set('@feed', feed)
31
+ assert_equal "https://www.exampleorigin.com/foo/bar/", @item.link
32
+ end
33
+
34
+ def test_link_full_link_with_feed_origin
35
+ @item.instance_variable_set('@link', 'https://www.exampleorigin.com/foo/bar/')
36
+ feed = FeedParser::Feed.new
37
+ feed.instance_variable_set('@origin', 'https://www.exampleorigin.com')
38
+ @item.instance_variable_set('@feed', feed)
39
+ assert_equal "https://www.exampleorigin.com/foo/bar/", @item.link
40
+ end
41
+
42
+ def test_link_with_non_ascii
43
+ @item.instance_variable_set('@link', 'https://www.example.people/☭/')
44
+ assert_equal "https://www.example.people/☭/", @item.link
45
+ end
46
+
47
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-feedparser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.6
4
+ version: 0.9.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lucas Nussbaum
8
8
  autorequire: feedparser
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-01-14 00:00:00.000000000 Z
11
+ date: 2021-02-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: magic
@@ -47,6 +47,7 @@ files:
47
47
  - lib/feedparser/version.rb
48
48
  - setup.rb
49
49
  - test/tc_feed_parse.rb
50
+ - test/tc_feeditem.rb
50
51
  - test/tc_html2text_parser.rb
51
52
  - test/tc_htmloutput.rb
52
53
  - test/tc_parser.rb