FIX: Show large image placeholder for image onebox (#21237)

Large or broken images are removed from oneboxes, but sometimes images
were removed when they were oneboxed too. The reason is that images can
be oneboxed by the AllowlistedGenericOnebox or ImageOnebox and only
AllowlistedGenericOnebox was handled correctly.
This commit is contained in:
Bianca Nenciu
2023-04-26 19:05:22 +02:00
committed by GitHub
parent a1b35601fc
commit 024b8b2640
2 changed files with 10 additions and 8 deletions

View File

@ -1152,13 +1152,13 @@ RSpec.describe CookedPostProcessor do
it "replaces large image placeholder" do
SiteSetting.max_image_size_kb = 4096
url = "https://image.com/my-avatar"
image_url = "https://image.com/avatar.png"
url = "https://image.com/avatar.png"
Oneboxer
.stubs(:onebox)
.with(url, anything)
.returns("<img class='onebox' src='#{image_url}' />")
Oneboxer.stubs(:onebox).with(url, anything).returns <<~HTML
<a href="#{url}" target="_blank" rel="noopener" class="onebox">
<img class='onebox' src='#{url}' />
</a>
HTML
post = Fabricate(:post, raw: url)