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 097276c
Show file tree
Hide file tree
Showing 6 changed files with 1,636 additions and 6 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
4 changes: 0 additions & 4 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,6 @@ GEM
base64 (0.2.0)
bcrypt (3.1.20)
bindex (0.8.1)
bootsnap (1.18.4)
msgpack (~> 1.2)
builder (3.3.0)
byebug (11.1.3)
capybara (3.40.0)
Expand Down Expand Up @@ -161,7 +159,6 @@ GEM
mini_magick (4.13.2)
mini_mime (1.1.5)
minitest (5.25.1)
msgpack (1.7.2)
net-imap (0.4.17)
date
net-protocol
Expand Down Expand Up @@ -293,7 +290,6 @@ PLATFORMS
DEPENDENCIES
aws-sdk-s3
bcrypt (~> 3.1.16)
bootsnap (>= 1.1.0)
byebug
capybara (~> 3.39)
commonmarker (~> 0.23)
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 097276c

Please sign in to comment.