Page MenuHomePhabricator

D8703.id20638.diff
No OneTemporary

D8703.id20638.diff

diff --git a/src/applications/project/phid/PhabricatorProjectPHIDTypeProject.php b/src/applications/project/phid/PhabricatorProjectPHIDTypeProject.php
--- a/src/applications/project/phid/PhabricatorProjectPHIDTypeProject.php
+++ b/src/applications/project/phid/PhabricatorProjectPHIDTypeProject.php
@@ -52,10 +52,8 @@
}
public static function getProjectMonogramPatternFragment() {
- // NOTE: This explicitly does not match strings which contain only
- // digits, because digit strings like "#123" are used to reference tasks at
- // Facebook and are somewhat conventional in general.
- return '[^\s.!,:;{}#]*[^\s\d.!,:;{}#]+[^\s.!,:;{}#]*';
+ // NOTE: See some discussion in ProjectRemarkupRule.
+ return '[^\s,#]+';
}
public function canLoadNamedObject($name) {
diff --git a/src/applications/project/remarkup/ProjectRemarkupRule.php b/src/applications/project/remarkup/ProjectRemarkupRule.php
--- a/src/applications/project/remarkup/ProjectRemarkupRule.php
+++ b/src/applications/project/remarkup/ProjectRemarkupRule.php
@@ -1,8 +1,5 @@
<?php
-/**
- * @group project
- */
final class ProjectRemarkupRule
extends PhabricatorRemarkupRuleObject {
@@ -11,8 +8,22 @@
}
protected function getObjectIDPattern() {
- return
- PhabricatorProjectPHIDTypeProject::getProjectMonogramPatternFragment();
+ // NOTE: This explicitly does not match strings which contain only
+ // digits, because digit strings like "#123" are used to reference tasks at
+ // Facebook and are somewhat conventional in general.
+
+ // The latter half of this rule matches monograms with internal periods,
+ // like `#domain.com`, but does not match monograms with terminal periods,
+ // because they're probably just puncutation.
+
+ // Broadly, this will not match every possible project monogram, and we
+ // accept some false negatives -- like `#1` or `#dot.` -- in order to avoid
+ // a bunch of false positives on general use of the `#` character.
+
+ // In other contexts, the PhabricatorProjectPHIDTypeProject pattern is
+ // controlling and these names should parse correctly.
+
+ return '[^\s.!,:;{}#]*[^\s\d!,:;{}#]+(?:[^\s.!,:;{}#][^\s!,:;{}#]*)*';
}
protected function loadObjects(array $ids) {

File Metadata

Mime Type
text/plain
Expires
Fri, Nov 1, 11:17 AM (2 w, 3 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6736059
Default Alt Text
D8703.id20638.diff (2 KB)

Event Timeline