Fix matching of very short project hashtags ending in a digit
Summary: Fixes T7625. The way the regexp worked, "unusual" terminal characters required at least one character as a prefix in order to match. Allow 0 instead, so `#a1` matches. Test Plan: Added and executed unit test. Reviewers: btrahan Reviewed By: btrahan Subscribers: epriestley Maniphest Tasks: T7625 Differential Revision: https://secure.phabricator.com/D12123
This commit is contained in:
@@ -30,7 +30,7 @@ final class ProjectRemarkupRule extends PhabricatorObjectRemarkupRule {
|
|||||||
// In other contexts, the PhabricatorProjectProjectPHIDType pattern is
|
// In other contexts, the PhabricatorProjectProjectPHIDType pattern is
|
||||||
// controlling and these names should parse correctly.
|
// controlling and these names should parse correctly.
|
||||||
|
|
||||||
return '[^\s.\d!,:;{}#\(\)]+(?:[^\s!,:;{}#\(\)][^\s.!,:;{}#\(\)]+)*';
|
return '[^\s.\d!,:;{}#\(\)]+(?:[^\s!,:;{}#\(\)]*[^\s.!,:;{}#\(\)]+)*';
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function loadObjects(array $ids) {
|
protected function loadObjects(array $ids) {
|
||||||
|
|||||||
@@ -70,6 +70,17 @@ final class ProjectRemarkupRuleTestCase extends PhabricatorTestCase {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
|
'#s3' => array(
|
||||||
|
'embed' => array(),
|
||||||
|
'ref' => array(
|
||||||
|
array(
|
||||||
|
'offset' => 1,
|
||||||
|
'id' => 's3',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach ($cases as $input => $expect) {
|
foreach ($cases as $input => $expect) {
|
||||||
|
|||||||
Reference in New Issue
Block a user