If a message only contains an img, it is cropped from the lightBody. In conversation cnv_41uvyv7, it caused message msg_80hsp1f content to be invisible unless clicking on ....
💭 Explain your solution and thought process.
In extractQuoteHtmlViaMarkers, the document we:
convert passed document into text using elementToText,
split the output text by lines,
remove the checkpoints that were added before extractQuoteHtmlViaMarkers,
map each line to a character representing its nature (empty [e], text [t], quote [m], splitter [s], forwarded [f]),
use the concatenation of those markers to recognize patterns.
The issue was that, in step 1, elementToText only returned the nodeValue of img (and others embedded contents tag) elements, which is its checkpoint value. Since the checkpoint value is then removed in step 3, nothing remained for lines containing img only, so it was marked as empty in step 4.
We therefore ended up with a marker string like that: eesmmm. With such marker we display by default the content of previous messages.
To fix that elementToText now append the src attribute of a tag to the string it returns. I took inspiration of a similar fix that appends the href attribute to the returned string. So the marker string is now etsmmm. This is closer to reality and does not cause the message's body to get cropped grom its lightBody.
JIRA
⛳ State the problem being solved.
If a message only contains an
img
, it is cropped from thelightBody
. In conversation cnv_41uvyv7, it caused message msg_80hsp1f content to be invisible unless clicking on...
.💭 Explain your solution and thought process.
In
extractQuoteHtmlViaMarkers
, the document we:elementToText
,extractQuoteHtmlViaMarkers
,The issue was that, in step 1,
elementToText
only returned thenodeValue
ofimg
(and others embedded contents tag) elements, which is its checkpoint value. Since the checkpoint value is then removed in step 3, nothing remained for lines containing img only, so it was marked as empty in step 4.We therefore ended up with a marker string like that:
eesmmm
. With such marker we display by default the content of previous messages.To fix that
elementToText
now append thesrc
attribute of a tag to the string it returns. I took inspiration of a similar fix that appends thehref
attribute to the returned string. So the marker string is nowetsmmm
. This is closer to reality and does not cause the message's body to get cropped grom itslightBody
.