#6342 Errors in ForgeLinkPattern parsing

v1.8.0
closed
None
General
nobody
2018-02-05
2013-06-06
No
  File "/var/local/allura/Allura/allura/command/show_models.py", line 127, in command
    update_refs=self.options.refs)
  File "/var/local/allura/Allura/allura/tasks/index_tasks.py", line 49, in add_artifacts
    link.ref_id for link in find_shortlinks(s['text']) ]
  File "/var/local/allura/Allura/allura/lib/search.py", line 212, in find_shortlinks
    md.convert(text)
  File "/var/local/env-allura/lib/python2.7/site-packages/Markdown-2.2.0-py2.7.egg/markdown/__init__.py", line 292, in convert
    newRoot = treeprocessor.run(root)
  File "/var/local/env-allura/lib/python2.7/site-packages/Markdown-2.2.0-py2.7.egg/markdown/treeprocessors.py", line 289, in run
    text), child)
  File "/var/local/env-allura/lib/python2.7/site-packages/Markdown-2.2.0-py2.7.egg/markdown/treeprocessors.py", line 110, in __handleInline
    data, patternIndex, startIndex)
  File "/var/local/env-allura/lib/python2.7/site-packages/Markdown-2.2.0-py2.7.egg/markdown/treeprocessors.py", line 237, in __applyPattern
    node = pattern.handleMatch(match)
  File "/var/local/allura/Allura/allura/lib/markdown_extensions.py", line 116, in handleMatch
    if 'notfound' in classes and not self.ext._use_wiki:
UnboundLocalError: local variable 'classes' referenced before assignment

Example somewhere in sbg901.arris's content for this:

  File "/var/local/allura/Allura/allura/tasks/index_tasks.py", line 49, in add_artifacts
    link.ref_id for link in find_shortlinks(s['text']) ]
  File "/var/local/allura/Allura/allura/lib/search.py", line 212, in find_shortlinks
    md.convert(text)
  File "/var/local/env-allura/lib/python2.7/site-packages/Markdown-2.2.0-py2.7.egg/markdown/__init__.py", line 292, in convert
    newRoot = treeprocessor.run(root)
  File "/var/local/env-allura/lib/python2.7/site-packages/Markdown-2.2.0-py2.7.egg/markdown/treeprocessors.py", line 289, in run
    text), child)
  File "/var/local/env-allura/lib/python2.7/site-packages/Markdown-2.2.0-py2.7.egg/markdown/treeprocessors.py", line 110, in __handleInline
    data, patternIndex, startIndex)
  File "/var/local/env-allura/lib/python2.7/site-packages/Markdown-2.2.0-py2.7.egg/markdown/treeprocessors.py", line 237, in __applyPattern
    node = pattern.handleMatch(match)
  File "/var/local/allura/Allura/allura/lib/markdown_extensions.py", line 107, in handleMatch
    el.set('href', self.sanitize_url(self.unescape(href.strip())))
  File "/var/local/env-allura/lib/python2.7/site-packages/Markdown-2.2.0-py2.7.egg/markdown/inlinepatterns.py", line 198, in unescape
    return util.INLINE_PLACEHOLDER_RE.sub(get_stash, text)
TypeError: sequence item 0: expected string or Unicode, Element found

Discussion

  • Dave Brondsema

    Dave Brondsema - 2017-10-12
    • status: open --> review
    • assigned_to: Dave Brondsema
     
  • Dave Brondsema

    Dave Brondsema - 2017-10-12

    First error fixed long time ago in [f398a06e1ca979922c366d30ad17060b53eb5988]

    Second error can be reproduced with [foo]( http://bar) and is fixed in Markdown. Upgrading Markdown from 2.2.0 to 2.2.1 fixes it. Would be good to upgrade much further, but there are various regressions, mostly with markdown internal placeholders showing up in the output, which is no good. This starts at 2.3 and perhaps is because of our own extensions needing update, but also I think due to handling invalid markdown (e.g. markdown within html) differently -- but I don't want that to break. More info at https://github.com/Python-Markdown/markdown/issues/458 and https://github.com/Python-Markdown/markdown/issues/222

    Fix in db/6342

     
  • Kenton Taylor - 2017-10-13
    • status: review --> closed
     
  • Kenton Taylor - 2017-10-13

    Merged.

     
  • Dave Brondsema

    Dave Brondsema - 2018-02-05
    • Milestone: unreleased --> v1.8.0
     

Log in to post a comment.