Page MenuHomePhabricator

D12692.id30468.diff
No OneTemporary

D12692.id30468.diff

diff --git a/src/infrastructure/markup/rule/PhabricatorObjectRemarkupRule.php b/src/infrastructure/markup/rule/PhabricatorObjectRemarkupRule.php
--- a/src/infrastructure/markup/rule/PhabricatorObjectRemarkupRule.php
+++ b/src/infrastructure/markup/rule/PhabricatorObjectRemarkupRule.php
@@ -166,7 +166,10 @@
$prefix = preg_quote($prefix);
$id = $this->getObjectIDPattern();
- return '(\B{'.$prefix.'('.$id.')([,\s](?:[^}\\\\]|\\\\.)*)?}\B)u';
+ $base_uri = PhabricatorEnv::getEnvConfig('phabricator.base-uri');
+ $base_uri = new PhutilURI($base_uri);
+
+ return '(\B{'.'(?:'.preg_quote($base_uri).'/)?'.$prefix.'('.$id.')([,\s](?:[^}\\\\]|\\\\.)*)?}\B)u';
}
private function getObjectReferencePattern() {
@@ -175,6 +178,8 @@
$id = $this->getObjectIDPattern();
+ $base_uri = new PhutilURI(PhabricatorEnv::getEnvConfig('phabricator.base-uri'));
+
// If the prefix starts with a word character (like "D"), we want to
// require a word boundary so that we don't match "XD1" as "D1". If the
// prefix does not start with a word character, we want to require no word
@@ -192,7 +197,7 @@
// The "\b" allows us to link "(abcdef)" or similar without linking things
// in the middle of words.
- return '((?<![#-])'.$boundary.$prefix.'('.$id.')(?:#([-\w\d]+))?(?!\w))u';
+ return '((?<![#-])'.$boundary.'(?:'.preg_quote($base_uri).'/)?'.$prefix.'('.$id.')(?:#([-\w\d]+))?(?!\w))u';
}
@@ -243,7 +248,7 @@
return $results;
}
- public function markupObjectEmbed($matches) {
+ public function markupObjectEmbed(array $matches) {
if (!$this->isFlatText($matches[0])) {
return $matches[0];
}
@@ -256,7 +261,7 @@
));
}
- public function markupObjectReference($matches) {
+ public function markupObjectReference(array $matches) {
if (!$this->isFlatText($matches[0])) {
return $matches[0];
}

File Metadata

Mime Type
text/plain
Expires
Wed, Mar 26, 1:06 AM (1 w, 20 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7688429
Default Alt Text
D12692.id30468.diff (1 KB)

Event Timeline