FIX: persist secure image width and height if is given (#10994)

`max-width: 50%; max-height: 400px;` is a good fallback, however, if width and height are given and are smaller than fallback -  we should persist that smaller size.
This commit is contained in:
Krzysztof Kotlarek
2020-10-22 13:25:09 +11:00
committed by GitHub
parent 64b0b50ac0
commit b2481adb40
4 changed files with 27 additions and 8 deletions

View File

@@ -966,12 +966,14 @@ describe PrettyText do
it "replaces secure images with a placeholder, keeping the url in an attribute" do
url = "/secure-media-uploads/original/1X/testimage.png"
html = <<~HTML
<img src=\"#{url}\">
<img src=\"#{url}\" width=\"20\" height=\"20\">
HTML
md = PrettyText.format_for_email(html, post)
expect(md).not_to include('<img')
expect(md).to include("Redacted")
expect(md).to include("data-stripped-secure-media=\"#{url}\"")
expect(md).to include("data-width=\"20\"")
expect(md).to include("data-height=\"20\"")
end
end
end