Merge pull request #1859 from basecamp/flavorjones/fix-broken-remote-images

Gracefully handle ill-formed remote images in rich text
This commit is contained in:
Mike Dalessio
2025-12-04 09:39:26 -05:00
committed by GitHub
3 changed files with 13 additions and 2 deletions
@@ -1,5 +1,5 @@
<figure class="attachment attachment--preview">
<%= image_tag remote_image.url, width: remote_image.width, height: remote_image.height %>
<%= image_tag remote_image.url, skip_pipeline: true, width: remote_image.width, height: remote_image.height %>
<% if caption = remote_image.try(:caption) %>
<figcaption class="attachment__caption">
<%= caption %>
@@ -1 +1 @@
<%= image_tag remote_image.url, class: "attachment attachment--image", width: remote_image.width, height: remote_image.height %>
<%= image_tag remote_image.url, skip_pipeline: true, class: "attachment attachment--image", width: remote_image.width, height: remote_image.height %>
+11
View File
@@ -121,4 +121,15 @@ class CardsControllerTest < ActionDispatch::IntegrationTest
assert_redirected_to boards(:writebook)
end
test "show card with comment containing malformed remote image attachment" do
card = cards(:logo)
card.comments.create!(
creator: users(:kevin),
body: '<action-text-attachment url="image.png" content-type="image/*" presentation="gallery"></action-text-attachment>'
)
get card_path(card)
assert_response :success
end
end