FIX: Maintain HTML <img when downloading remote images (#16278)

Under some conditions, replacing an `<img` with `![]()` can break rendering, and make the image disappear.

Context at https://meta.discourse.org/t/152801
This commit is contained in:
David Taylor
2022-03-29 10:55:10 +01:00
committed by GitHub
parent 8e5614b1bf
commit b2a8dc4c0f
5 changed files with 48 additions and 54 deletions

View File

@ -614,7 +614,7 @@ describe Email::Receiver do
expect(post.raw).to eq(<<~MD.chomp)
**Before**
![#{upload.original_filename}|#{upload.width}x#{upload.height}](#{upload.short_url})
<img src="#{upload.short_url}" alt="内嵌图片 1">
*After*
MD
@ -648,7 +648,7 @@ describe Email::Receiver do
<details class='elided'>
<summary title='Show trimmed content'>&#183;&#183;&#183;</summary>
![logo.png|300x200](upload://qUm0DGR49PAZshIi7HxMd3cAlzn.png)
<img src="upload://qUm0DGR49PAZshIi7HxMd3cAlzn.png" width="300" height="200">
</details>
MD
@ -673,7 +673,7 @@ describe Email::Receiver do
expect(post.raw).to eq(<<~MD.chomp)
Picture below.
![#{upload.original_filename}|#{upload.width}x#{upload.height}](#{upload.short_url})
<img apple-inline="yes" id="06C04C58-783E-4753-9B6B-D57403903060" src="#{upload.short_url}" class="">
Picture above.
MD