mantisbt-plugins / source-integration

Source control integration plugin framework for MantisBT, including support for Github, Gitlab, Bitbucket, Gitea, Gitweb, Cgit, Subversion, Mercurial and more
http://noswap.com/projects/source-integration/
MIT License
181 stars 130 forks source link

Changeset reference not processed at beginning of bugnote #351

Closed dregad closed 3 years ago

dregad commented 3 years ago

Given a bugnote with the following contents, Source Integration does not transform it into a link to the given commit.

c:repo:sha:

If the reference is preceded by whitespace, then it works properly

test c:repo:sha:
dregad commented 3 years ago

This is a follow-up of #204 - the updated regex (see commit 3dbec8114247b930f378dbda248310307a365cbf) does not fully take into consideration the fact that the string received in SourcePlugin::display_formatted() has already been processed by the MantisCoreFormatting plugin.

The ^ in the regex's lookbehind intended to match the beginning of the string, does not work because in in the example above, the actual value of $p_text parameter is

<p>c:repo:sha</p>

So the character preceding the changeset reference is neither whitespace, nor the string's beginning so there is no match.

dregad commented 3 years ago

This fix should have been committed separately, but was inadvertently included in c888810aee6887127243132438005b53d700b54e (-> fixed in 2.4.1).