Skip to content

Commit 427dc74

Browse files
committed
make Haven resilant to feeds that have items missing links
1 parent ed8777c commit 427dc74

File tree

4 files changed

+1635
-1
lines changed

4 files changed

+1635
-1
lines changed

app/views/feeds/read.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ end
5454
<source src="<%= entry.audio %>" type="audio/mpeg">
5555
</audio>
5656
<% end %>
57-
<% if entry.link.start_with? "https://www.youtube.com/watch?v="
57+
<% if !entry.link.nil? && entry.link.start_with?("https://www.youtube.com/watch?v=")
5858
video_id = entry.link.split("?v=").last.split("&").first
5959
video_img = "https://img.youtube.com/vi/#{video_id}/0.jpg"
6060
%>

lib/haven_feed_entry.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ def initialize(feed, item)
1010
@feed_title = feed.channel.title
1111
@title = item.title
1212
@link = item.link
13+
@link = "" if @link.nil? ## prevent missing links from pulling nils into the DB
1314
@date = parse_time(item.date)
1415
@content = item.description
1516
@content = item.content_encoded if item.content_encoded

0 commit comments

Comments
 (0)