Skip to content

Commit

Permalink
Always default validate_cert and seen_by_guid
Browse files Browse the repository at this point in the history
  • Loading branch information
StormPooper authored and nning committed Nov 16, 2022
1 parent 55a29ba commit 7afc21a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/transmission-rss/aggregator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def process_link(feed, item)
link = link.href if link.class != String

# Determine whether to use guid or link as seen hash
seen_value = !!feed.seen_by_guid ? (item.guid.content rescue item.guid || link).to_s : link
seen_value = feed.seen_by_guid ? (item.guid.content rescue item.guid || link).to_s : link

# The link is not in +@seen+ Array.
unless @seen.include?(seen_value)
Expand Down
5 changes: 3 additions & 2 deletions lib/transmission-rss/feed.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ def initialize(config = {})
@url = URI.escape(URI.unescape(config['url'] || config.keys.first))

@download_path = config['download_path']
@validate_cert = config['validate_cert'].nil? || !!config['validate_cert']
@seen_by_guid = !!config['seen_by_guid']

matchers = Array(config['regexp']).map do |e|
e.is_a?(String) ? e : e['matcher']
Expand All @@ -26,6 +24,9 @@ def initialize(config = {})
@config = {}
@url = config.to_s
end

@validate_cert = @config['validate_cert'].nil? || !!@config['validate_cert']
@seen_by_guid = !!@config['seen_by_guid']
end

def download_path(title = nil)
Expand Down
4 changes: 2 additions & 2 deletions spec/feed_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
expect(feed.config).not_to be_nil
expect(feed.download_path).to be_nil
expect(feed.regexp).to be_nil
expect(feed.validate_cert).to be_nil
expect(feed.seen_by_guid).to be_nil
expect(feed.validate_cert).to eq(true)
expect(feed.seen_by_guid).to eq(false)
end

it 'should be able to parse encoded url' do
Expand Down

0 comments on commit 7afc21a

Please sign in to comment.