Fixes #2701 - Can't forward articles containing a <img> tag without src attribute.
This commit is contained in:
parent
1afa52f5f7
commit
adf4442648
2 changed files with 13 additions and 3 deletions
|
@ -1205,9 +1205,12 @@ class App.Utils
|
||||||
|
|
||||||
html.find('img').each( (index) ->
|
html.find('img').each( (index) ->
|
||||||
src = $(@).attr('src')
|
src = $(@).attr('src')
|
||||||
if !src.match(/^(data|cid):/i) # <img src="cid: ..."> may mean broken emails (see issue #2305)
|
|
||||||
base64 = App.Utils._htmlImage2DataUrl(@)
|
# <img src="cid: ..."> or an empty src attribute may mean broken emails (see issue #2305 / #2701)
|
||||||
$(@).attr('src', base64)
|
return if !src? or src.match(/^(data|cid):/i)
|
||||||
|
|
||||||
|
base64 = App.Utils._htmlImage2DataUrl(@)
|
||||||
|
$(@).attr('src', base64)
|
||||||
)
|
)
|
||||||
html.get(0).innerHTML
|
html.get(0).innerHTML
|
||||||
|
|
||||||
|
|
|
@ -3167,11 +3167,18 @@ test("htmlImage2DataUrl", function() {
|
||||||
result = App.Utils.htmlImage2DataUrl(source)
|
result = App.Utils.htmlImage2DataUrl(source)
|
||||||
equal(result, should, source)
|
equal(result, should, source)
|
||||||
|
|
||||||
|
// GitHub issue #2305
|
||||||
source = '<img src="cid:1234">some test'
|
source = '<img src="cid:1234">some test'
|
||||||
should = '<img src="cid:1234">some test'
|
should = '<img src="cid:1234">some test'
|
||||||
result = App.Utils.htmlImage2DataUrl(source)
|
result = App.Utils.htmlImage2DataUrl(source)
|
||||||
equal(result, should, 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() {
|
test('App.Utils.icon()', function() {
|
||||||
|
|
Loading…
Reference in a new issue