message, caption: move mention offsets past the characters XML cannot carry #25
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/C3-mention-offsets-after-strip"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What and why
send,send_file,send_albumandset_captionstrip what XML 1.0 cannotcarry (
XmlText), then check the caller's mentions against the cleaned textwithout moving them. A mention after a stripped character went out pointing
past its words (XEP-0426 §2). The new
XmlTextMentionsmoves eachbegin/endback by the characters dropped before it.
sendapplies it before the Matrixroute and the main path, and
CaptionMentionsbefore its leading-space shift.Tests
test_message_mentions.tcl:mentions-send-moves-past-the-characters-xml-cannot-carrytest_caption.tcl:caption-mentions-move-past-the-characters-xml-cannot-carryBoth fail on develop. With the fix, test_message_mentions passes 40/40,
test_caption 18/18 and test_message 618/618.
Verified
Rebased on develop
56d29734; test_message_mentions, test_caption and test_message pass (679 total, 0 failed).On Prosody 13, slot 1, running
XEP-0426.pyunchanged:begin='30' end='34'coversee e): https://dev.another.im/another-im/interop/src/branch/ai-runs-2026-11-07/runs/20261107-215610-XEP-0426-slixmpp-prosodybegin='28' end='32'is@Bee): https://dev.another.im/another-im/interop/src/branch/ai-runs-2026-11-07/runs/20261107-215616-XEP-0426-slixmpp-prosodyAlso reproduced by hand in anotherim-js 0.8.0-beta5 in an OMEMO chat (see #24).
Fixes #24
Fixed upstream in v1.2.1 by
67d627cf("message: mentions move past the characters XML cannot carry, so a mention still marks the words it marked (interop C3)"). It has the same code and tests as this branch (git patch-id), so this is closed as a duplicate.Found by hand since filing, in anotherim-js
developwith libtackydevelop56d29734:message sendrefuses the whole send, and the message silently isn't sent.begin='3' end='21'(exactly@Nick).Pull request closed