fix: escape special characters in task-list items on upload - #31
Merged
Merged
Conversation
blaipr
force-pushed
the
fix/escape-task-and-panel-text
branch
from
September 2, 2026 22:35
86b30fb to
7a69dd9
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Step 6 of
md_to_confluence_storagebuilt each task body with"".join(str(c) for c in li.children).str()on a text node returns the raw text, so an item such as- [ ] check a < bor- [x] talk to R&Dproduced<span>check a < b</span>— invalid XML that Confluence rejects onuploadandedit. Step 7 (panel bodies) used the same idiom; it happened to be safe because a blockquote's children are always<p>tags, but it was one refactor away from the same bug.Change
Both steps now serialise with
decode_contents(), which escapes text nodes the same way the rest of the document is escaped. A comment on the task-list step records whystr()per child is wrong there.Compatibility
Upload only. Pages whose checklists contain
<,>or&now upload instead of failing; everything else serialises byte-for-byte as before (the round trip for such items is covered by a new test).Checklist
ruff check src tests,ruff format --check src testsandpython -m pytest tests/passtests/test_task_lists.py,tests/test_md_to_storage.py)docs/conversion.md— not neededCHANGELOG.mdupdated under Unreleased