HomePhabricator

textlib.py: Limit catastrophic backtracking in FILE_LINK_REGEX

Authored by Dalba on Oct 31 2016, 2:57 AM.

Description

textlib.py: Limit catastrophic backtracking in FILE_LINK_REGEX

Make use of the fact that wikilinks cannot contain other wikilinks.

This breaks the test that asserts wikilinks inside files can contain other
wikilinks. Remove that test. This should be OK because MediaWiki does not
allow such syntax errors, too, i.e.
[[File:example.jpg|[[foo]] [[bar [[invalid]] ]].x]]
won't be rendered as an image by MediaWiki.

Bug: T148959
Change-Id: Id300a386a1760cca5717ac907108e8f34d51e222