1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-23 22:10:55 +01:00

Don't link objects after a hyphen

Summary: Fixes T5714. Don't link objects when their names appear after a hyphen.

Test Plan: Tested `F123` (link), `(F123)` (link), `G12-F123` (no link).

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T5714

Differential Revision: https://secure.phabricator.com/D10456
This commit is contained in:
epriestley 2014-09-09 16:38:42 -07:00
parent f02aed10e7
commit b09f8fa9b8

View file

@ -115,12 +115,14 @@ abstract class PhabricatorObjectRemarkupRule extends PhutilRemarkupRule {
$boundary = '\\B'; $boundary = '\\B';
} }
// NOTE: The "(?<!#)" prevents us from linking "#abcdef" or similar. // The "(?<![#-])" prevents us from linking "#abcdef" or similar, and
// "ABC-T1" (see T5714).
// The "\b" allows us to link "(abcdef)" or similar without linking things // The "\b" allows us to link "(abcdef)" or similar without linking things
// in the middle of words. // in the middle of words.
$text = preg_replace_callback( $text = preg_replace_callback(
'((?<!#)'.$boundary.$prefix.'('.$id.')(?:#([-\w\d]+))?\b)', '((?<![#-])'.$boundary.$prefix.'('.$id.')(?:#([-\w\d]+))?\b)',
array($this, 'markupObjectReference'), array($this, 'markupObjectReference'),
$text); $text);