Skip to content

Commit

Permalink
make Haven resilant to feeds that have items missing links
Browse files Browse the repository at this point in the history
note: also revert github actions build to ubuntu-22.04 to resolve gcc segfaults for native exensions on arm64
see example failure here: https://github.com/havenweb/haven/actions/runs/13115117753/job/36587454025
  • Loading branch information
mawise committed Feb 3, 2025
1 parent ed8777c commit 075639d
Show file tree
Hide file tree
Showing 6 changed files with 1,637 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

jobs:
build:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ GEM
mini_magick (4.13.2)
mini_mime (1.1.5)
minitest (5.25.1)
msgpack (1.7.2)
msgpack (1.7.5)
net-imap (0.4.17)
date
net-protocol
Expand Down
2 changes: 1 addition & 1 deletion app/views/feeds/read.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ end
<source src="<%= entry.audio %>" type="audio/mpeg">
</audio>
<% end %>
<% if entry.link.start_with? "https://www.youtube.com/watch?v="
<% if !entry.link.nil? && entry.link.start_with?("https://www.youtube.com/watch?v=")
video_id = entry.link.split("?v=").last.split("&").first
video_img = "https://img.youtube.com/vi/#{video_id}/0.jpg"
%>
Expand Down
1 change: 1 addition & 0 deletions lib/haven_feed_entry.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ def initialize(feed, item)
@feed_title = feed.channel.title
@title = item.title
@link = item.link
@link = "" if @link.nil? ## prevent missing links from pulling nils into the DB
@date = parse_time(item.date)
@content = item.description
@content = item.content_encoded if item.content_encoded
Expand Down
Loading

0 comments on commit 075639d

Please sign in to comment.