Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F18636058
D12692.id31247.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D12692.id31247.diff
View Options
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
@@ -9,7 +9,7 @@
abstract protected function loadObjects(array $ids);
public function getPriority() {
- return 450.0;
+ return 350.0;
}
protected function getObjectNamePrefixBeginsWithWordCharacter() {
@@ -53,7 +53,7 @@
return $uri;
}
- protected function renderObjectRefForAnyMedia (
+ protected function renderObjectRefForAnyMedia(
$object,
PhabricatorObjectHandle $handle,
$anchor,
@@ -129,7 +129,7 @@
$status_closed = PhabricatorObjectHandle::STATUS_CLOSED;
$attr = array(
'phid' => $handle->getPHID(),
- 'closed' => ($handle->getStatus() == $status_closed),
+ 'closed' => ($handle->getStatus() == $status_closed),
);
return $this->renderHovertag($name, $href, $attr);
@@ -189,7 +189,12 @@
$prefix = preg_quote($prefix);
$id = $this->getObjectIDPattern();
- return '(\B{'.$prefix.'('.$id.')([,\s](?:[^}\\\\]|\\\\.)*)?}\B)u';
+ return
+ '(\B{'.
+ '([a-zA-Z]+://\w+\.\w+/)?'.
+ $prefix.'('.$id.')'.
+ '([,\s](?:[^}\\\\]|\\\\.)*)?'.
+ '}\B)u';
}
private function getObjectReferencePattern() {
@@ -211,11 +216,14 @@
// 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
// in the middle of words.
-
- return '((?<![#-])'.$boundary.$prefix.'('.$id.')(?:#([-\w\d]+))?(?!\w))u';
+ return
+ '((?<![#-=/\?&])'.$boundary.
+ '([a-zA-Z]+://\w+\.\w+/)?'.
+ $prefix.'('.$id.')'.
+ '(?:#([-\w\d]+))?(?![\w/]))u';
}
@@ -252,11 +260,11 @@
$formatted = array();
foreach ($matches as $match) {
$format = array(
- 'offset' => $match[1][1],
- 'id' => $match[1][0],
+ 'offset' => $match[2][1],
+ 'id' => $match[2][0],
);
- if (isset($match[2][0])) {
- $format['tail'] = $match[2][0];
+ if (isset($match[3][0])) {
+ $format['tail'] = $match[3][0];
}
$formatted[] = $format;
}
@@ -271,10 +279,21 @@
return $matches[0];
}
+ if ($matches[1]) {
+ $uri = new PhutilURI($matches[1]);
+
+ $base_uri = PhabricatorEnv::getEnvConfig('phabricator.base-uri');
+ $base_uri = new PhutilURI($base_uri);
+
+ if (strtolower($uri->getDomain()) != strtolower($base_uri->getDomain())) {
+ return $matches[0];
+ }
+ }
+
return $this->markupObject(array(
'type' => 'embed',
- 'id' => $matches[1],
- 'options' => idx($matches, 2),
+ 'id' => $matches[2],
+ 'options' => idx($matches, 3),
'original' => $matches[0],
));
}
@@ -284,10 +303,21 @@
return $matches[0];
}
+ if ($matches[1]) {
+ $uri = new PhutilURI($matches[1]);
+
+ $base_uri = PhabricatorEnv::getEnvConfig('phabricator.base-uri');
+ $base_uri = new PhutilURI($base_uri);
+
+ if (strtolower($uri->getDomain()) != strtolower($base_uri->getDomain())) {
+ return $matches[0];
+ }
+ }
+
return $this->markupObject(array(
'type' => 'ref',
- 'id' => $matches[1],
- 'anchor' => idx($matches, 2),
+ 'id' => $matches[2],
+ 'anchor' => idx($matches, 3),
'original' => $matches[0],
));
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sep 18 2025, 3:28 AM (5 w, 2 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
8816817
Default Alt Text
D12692.id31247.diff (3 KB)
Attached To
Mode
D12692: Allow full URIs to be rendered as object references
Attached
Detach File
Event Timeline
Log In to Comment