Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Markdown parser crashes on emphasized text in deleted text in list item #1838

Open
sebix opened this issue Feb 12, 2025 · 0 comments
Open

Markdown parser crashes on emphasized text in deleted text in list item #1838

sebix opened this issue Feb 12, 2025 · 0 comments

Comments

@sebix
Copy link
Contributor

sebix commented Feb 12, 2025

This markdown text:

 * <del>Deleted list item with _emphasized text_</del>

causes the following exception:

2025-02-12 16:54:11,193 ERROR moin.items.content:316 An exception happened in _render_data (error_id = 08f9c665-393d-4890-94d7-e67430dc4e7f ):
Traceback (most recent call last):
  File "/home/sebastianw/dev/moin/src/moin/items/content.py", line 304, in _render_data
    doc = self.internal_representation(preview=preview)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/sebastianw/dev/moin/src/moin/utils/clock.py", line 65, in wrapper
    retval = f(*args, **kw)
             ^^^^^^^^^^^^^^
  File "/home/sebastianw/dev/moin/src/moin/items/content.py", line 260, in internal_representation
    doc = input_conv(preview or self.rev, self.contenttype, arguments=attributes)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/sebastianw/dev/moin/src/moin/converters/markdown_in.py", line 632, in __call__
    self.convert_embedded_markup(converted)
  File "/home/sebastianw/dev/moin/src/moin/converters/markdown_in.py", line 540, in convert_embedded_markup
    self.convert_embedded_markup(child)
  File "/home/sebastianw/dev/moin/src/moin/converters/markdown_in.py", line 540, in convert_embedded_markup
    self.convert_embedded_markup(child)
  File "/home/sebastianw/dev/moin/src/moin/converters/markdown_in.py", line 540, in convert_embedded_markup
    self.convert_embedded_markup(child)
  File "/home/sebastianw/dev/moin/src/moin/converters/markdown_in.py", line 536, in convert_embedded_markup
    node[idx] = self.embedded_markup(child)  # child is immutable string, so must do node[idx]
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/sebastianw/dev/moin/src/moin/converters/markdown_in.py", line 519, in embedded_markup
    p_text = html_in_converter(f"<p>{text}</p>")
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/sebastianw/dev/moin/src/moin/converters/html_in.py", line 156, in __call__
    html_tree = HTML(html_str)
                ^^^^^^^^^^^^^^
  File "/home/sebastianw/dev/moin-venv-python3/lib64/python3.11/site-packages/emeraldtree/html.py", line 191, in HTML
    parser.feed(text)
  File "/usr/lib64/python3.11/html/parser.py", line 110, in feed
    self.goahead(0)
  File "/usr/lib64/python3.11/html/parser.py", line 172, in goahead
    k = self.parse_endtag(i)
        ^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/html/parser.py", line 413, in parse_endtag
    self.handle_endtag(elem)
  File "/home/sebastianw/dev/moin-venv-python3/lib64/python3.11/site-packages/emeraldtree/html.py", line 128, in handle_endtag
    self.handle_endtag(lasttag)
  File "/home/sebastianw/dev/moin-venv-python3/lib64/python3.11/site-packages/emeraldtree/html.py", line 126, in handle_endtag
    lasttag = self.__stack.pop()
              ^^^^^^^^^^^^^^^^^^
IndexError: pop from empty list

The UI shows

Oops!

An error happened while processing your request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant