feedjira 2.1.3 → 2.1.4

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
- SHA1:
3
- metadata.gz: 84112aa57b8bc969b03dd280d4ab4ce70d241bfc
4
- data.tar.gz: 06ad42dd1c162c7505ece722e04a542522eb5e56
2
+ SHA256:
3
+ metadata.gz: 573606467835d2066d0548ce3c3ddaf52cb2d9ed873e37f5b87f689cd3bbed20
4
+ data.tar.gz: ab95795c457c2d82636a7b92a16352b6cd97a2cae20658ac9c6d15b138e7225d
5
5
  SHA512:
6
- metadata.gz: 9a241ef87f499b3210f27e8ee73b459585045d0b8593eb8455091987b0aeb75fc1e05d9bb015b2176bbdb699ff765936d7f436425ecd1fcdbb9677fec35c462d
7
- data.tar.gz: da03f4b6c0fe93ff567d1d09b67b2e69fde711ce2c5468717ab694bfda457193a22a5349b48c4ccb0b3b335bb90d372ceef4a2945eb77fddf253a67adc0aaf9c
6
+ metadata.gz: 51fd592d656f870880f60fa610f19e041d74dd839e3b4096dbfbf164c4a2bf9a25d89fbb5d714cdaa8a1379683ddab438d6a8b9fc4b8ca464f1369075aa78342
7
+ data.tar.gz: c528819390fc917d18ff8eae6c126064e1097b3ddbc27b7e1f6357854e57fb3ecdc558c002700137096fc471975f8e99ec1b717cc5725955439d60f31123035f
@@ -1,5 +1,10 @@
1
1
  # Feedjira Changelog
2
2
 
3
+ ## 2.1.4
4
+
5
+ * Bug fixes
6
+ * Prevent errors when a feed has multiple dates and some are unparseable
7
+
3
8
  ## 2.1.3
4
9
 
5
10
  * Enhancements
@@ -28,14 +28,14 @@ module Feedjira
28
28
  # Writer for published. By default, we keep the "oldest" publish time found.
29
29
  def published=(val)
30
30
  parsed = parse_datetime(val)
31
- @published = parsed if !@published || parsed < @published
31
+ @published = parsed if parsed && (!@published || parsed < @published)
32
32
  end
33
33
 
34
34
  ##
35
35
  # Writer for updated. By default, we keep the most recent update time found.
36
36
  def updated=(val)
37
37
  parsed = parse_datetime(val)
38
- @updated = parsed if !@updated || parsed > @updated
38
+ @updated = parsed if parsed && (!@updated || parsed > @updated)
39
39
  end
40
40
 
41
41
  def sanitize!
@@ -1,3 +1,3 @@
1
1
  module Feedjira
2
- VERSION = '2.1.3'.freeze
2
+ VERSION = '2.1.4'.freeze
3
3
  end
@@ -144,6 +144,16 @@ describe Feedjira::Feed do
144
144
  expect(feed.entries.first.published).to eq published
145
145
  expect(feed.entries.size).to eq 3
146
146
  end
147
+
148
+ it 'does not fail if multiple published dates exist and some are unparseable' do
149
+ expect(Feedjira.logger).to receive(:warn).once
150
+
151
+ feed = Feedjira::Feed.parse(sample_invalid_date_format_feed)
152
+ expect(feed.title).to eq 'Invalid date format feed'
153
+ published = Time.parse_safely 'Mon, 16 Oct 2017 15:10:00 GMT'
154
+ expect(feed.entries.first.published).to eq published
155
+ expect(feed.entries.size).to eq 2
156
+ end
147
157
  end
148
158
 
149
159
  context "when there's no available parser" do
@@ -26,7 +26,8 @@ module SampleFeeds
26
26
  sample_feed_burner_atom_xhtml_feed: 'FeedBurnerXHTML.xml',
27
27
  sample_duplicate_content_atom_feed: 'DuplicateContentAtomFeed.xml',
28
28
  sample_youtube_atom_feed: 'youtube_atom.xml',
29
- sample_atom_xhtml_with_escpaed_html_in_pre_tag_feed: 'AtomEscapedHTMLInPreTag.xml'
29
+ sample_atom_xhtml_with_escpaed_html_in_pre_tag_feed: 'AtomEscapedHTMLInPreTag.xml',
30
+ sample_invalid_date_format_feed: 'InvalidDateFormat.xml'
30
31
  }.freeze
31
32
 
32
33
  FEEDS.each do |method, filename|
@@ -0,0 +1,20 @@
1
+ <?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
2
+ xmlns:dc="http://purl.org/dc/elements/1.1/">
3
+
4
+ <channel>
5
+ <title>Invalid date format feed</title>
6
+ <link>http://example.com/feed</link>
7
+ <language>en-US</language>
8
+ <item>
9
+ <title>Item 0 with an invalid date</title>
10
+ <link>http://example.com/item0</link>
11
+ <pubDate>Mon, 16 Oct 2017 15:10:00 +0000</pubDate>
12
+ <dc:date>1518478934</dc:date>
13
+ </item>
14
+ <item>
15
+ <title>Item 1 with all valid dates</title>
16
+ <link>http://example.com/item1</link>
17
+ <pubDate>Tue, 17 Oct 2017 12:17:00 +0000</pubDate>
18
+ <dc:date>Tue, 17 Oct 2017 22:17:00 +0000</dc:date>
19
+ </item>
20
+ </channel>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: feedjira
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.3
4
+ version: 2.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paul Dix
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2017-12-11 00:00:00.000000000 Z
14
+ date: 2018-02-15 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: faraday
@@ -245,6 +245,7 @@ files:
245
245
  - spec/sample_feeds/HREFConsideredHarmfulFirstEntry.xml
246
246
  - spec/sample_feeds/ITunesWithSingleQuotedAttributes.xml
247
247
  - spec/sample_feeds/ITunesWithSpacesInAttributes.xml
248
+ - spec/sample_feeds/InvalidDateFormat.xml
248
249
  - spec/sample_feeds/PaulDixExplainsNothing.xml
249
250
  - spec/sample_feeds/PaulDixExplainsNothingAlternate.xml
250
251
  - spec/sample_feeds/PaulDixExplainsNothingFirstEntryContent.xml
@@ -282,63 +283,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
282
283
  version: '0'
283
284
  requirements: []
284
285
  rubyforge_project:
285
- rubygems_version: 2.6.13
286
+ rubygems_version: 2.7.3
286
287
  signing_key:
287
288
  specification_version: 4
288
289
  summary: A feed fetching and parsing library
289
- test_files:
290
- - spec/feedjira/configuration_spec.rb
291
- - spec/feedjira/date_time_utilities_spec.rb
292
- - spec/feedjira/feed_entry_utilities_spec.rb
293
- - spec/feedjira/feed_spec.rb
294
- - spec/feedjira/feed_utilities_spec.rb
295
- - spec/feedjira/parser/atom_entry_spec.rb
296
- - spec/feedjira/parser/atom_feed_burner_entry_spec.rb
297
- - spec/feedjira/parser/atom_feed_burner_spec.rb
298
- - spec/feedjira/parser/atom_spec.rb
299
- - spec/feedjira/parser/atom_youtube_entry_spec.rb
300
- - spec/feedjira/parser/atom_youtube_spec.rb
301
- - spec/feedjira/parser/google_docs_atom_entry_spec.rb
302
- - spec/feedjira/parser/google_docs_atom_spec.rb
303
- - spec/feedjira/parser/itunes_rss_item_spec.rb
304
- - spec/feedjira/parser/itunes_rss_owner_spec.rb
305
- - spec/feedjira/parser/itunes_rss_spec.rb
306
- - spec/feedjira/parser/podlove_chapter_spec.rb
307
- - spec/feedjira/parser/rss_entry_spec.rb
308
- - spec/feedjira/parser/rss_feed_burner_entry_spec.rb
309
- - spec/feedjira/parser/rss_feed_burner_spec.rb
310
- - spec/feedjira/parser/rss_spec.rb
311
- - spec/feedjira/preprocessor_spec.rb
312
- - spec/sample_feeds.rb
313
- - spec/sample_feeds/AmazonWebServicesBlog.xml
314
- - spec/sample_feeds/AmazonWebServicesBlogFirstEntryContent.xml
315
- - spec/sample_feeds/AtomEscapedHTMLInPreTag.xml
316
- - spec/sample_feeds/AtomFeedWithSpacesAroundEquals.xml
317
- - spec/sample_feeds/CRE.xml
318
- - spec/sample_feeds/DuplicateContentAtomFeed.xml
319
- - spec/sample_feeds/FeedBurnerUrlNoAlternate.xml
320
- - spec/sample_feeds/FeedBurnerXHTML.xml
321
- - spec/sample_feeds/FeedjiraBlog.xml
322
- - spec/sample_feeds/GiantRobotsSmashingIntoOtherGiantRobots.xml
323
- - spec/sample_feeds/GoogleDocsList.xml
324
- - spec/sample_feeds/HREFConsideredHarmful.xml
325
- - spec/sample_feeds/HREFConsideredHarmfulFirstEntry.xml
326
- - spec/sample_feeds/ITunesWithSingleQuotedAttributes.xml
327
- - spec/sample_feeds/ITunesWithSpacesInAttributes.xml
328
- - spec/sample_feeds/PaulDixExplainsNothing.xml
329
- - spec/sample_feeds/PaulDixExplainsNothingAlternate.xml
330
- - spec/sample_feeds/PaulDixExplainsNothingFirstEntryContent.xml
331
- - spec/sample_feeds/PaulDixExplainsNothingWFW.xml
332
- - spec/sample_feeds/SamRuby.xml
333
- - spec/sample_feeds/TechCrunch.xml
334
- - spec/sample_feeds/TechCrunchFirstEntry.xml
335
- - spec/sample_feeds/TechCrunchFirstEntryDescription.xml
336
- - spec/sample_feeds/TenderLovemaking.xml
337
- - spec/sample_feeds/TenderLovemakingFirstEntry.xml
338
- - spec/sample_feeds/TrotterCashionHome.xml
339
- - spec/sample_feeds/TypePadNews.xml
340
- - spec/sample_feeds/atom_with_link_tag_for_url_unmarked.xml
341
- - spec/sample_feeds/itunes.xml
342
- - spec/sample_feeds/pet_atom.xml
343
- - spec/sample_feeds/youtube_atom.xml
344
- - spec/spec_helper.rb
290
+ test_files: []