Fixes #2701 - Can't forward articles containing a <img> tag without src attribute.

This commit is contained in:
Ryan Lue 2019-10-11 17:04:01 +02:00 committed by Thorsten Eckel
parent 1afa52f5f7
commit adf4442648
2 changed files with 13 additions and 3 deletions

View file

@ -1205,9 +1205,12 @@ class App.Utils
html.find('img').each( (index) ->
src = $(@).attr('src')
if !src.match(/^(data|cid):/i) # <img src="cid: ..."> may mean broken emails (see issue #2305)
base64 = App.Utils._htmlImage2DataUrl(@)
$(@).attr('src', base64)
# <img src="cid: ..."> or an empty src attribute may mean broken emails (see issue #2305 / #2701)
return if !src? or src.match(/^(data|cid):/i)
base64 = App.Utils._htmlImage2DataUrl(@)
$(@).attr('src', base64)
)
html.get(0).innerHTML

View file

@ -3167,11 +3167,18 @@ test("htmlImage2DataUrl", function() {
result = App.Utils.htmlImage2DataUrl(source)
equal(result, should, source)
// GitHub issue #2305
source = '<img src="cid:1234">some test'
should = '<img src="cid:1234">some test'
result = App.Utils.htmlImage2DataUrl(source)
equal(result, should, source)
// GitHub issue #2701
source = '<img alt="foo">some test'
should = '<img alt="foo">some test'
result = App.Utils.htmlImage2DataUrl(source)
equal(result, should, source)
});
test('App.Utils.icon()', function() {