Page MenuHomePhabricator

D12691.id.diff
No OneTemporary

D12691.id.diff

diff --git a/src/markup/engine/remarkup/markuprule/PhutilRemarkupHyperlinkRule.php b/src/markup/engine/remarkup/markuprule/PhutilRemarkupHyperlinkRule.php
--- a/src/markup/engine/remarkup/markuprule/PhutilRemarkupHyperlinkRule.php
+++ b/src/markup/engine/remarkup/markuprule/PhutilRemarkupHyperlinkRule.php
@@ -17,7 +17,7 @@
$text);
// Anything else we match "ungreedily", which means we'll look for
- // stuff that's probably puncutation or otherwise not part of the URL and
+ // stuff that's probably punctuation or otherwise not part of the URL and
// not link it. This lets someone write "QuicK! Go to
// http://www.example.com/!". We also apply some paren balancing rules.
@@ -32,17 +32,26 @@
}
protected function markupHyperlink($matches) {
+ $base_uri = new PhutilURI(PhabricatorEnv::getEnvConfig('phabricator.base-uri'));
$protocols = $this->getEngine()->getConfig(
'uri.allowed-protocols',
array());
- $protocol = id(new PhutilURI($matches[1]))->getProtocol();
- if (!idx($protocols, $protocol)) {
+ $uri = new PhutilURI($matches[1]);
+
+ if (!idx($protocols, $uri->getProtocol())) {
// If this URI doesn't use a whitelisted protocol, don't link it. This
// is primarily intended to prevent javascript:// silliness.
return $this->getEngine()->storeText($matches[1]);
}
+ if ($uri->getDomain() == $base_uri->getDomain()) {
+ // Don't modify the text. This allows PhabricatorObjectRemarkupRule the
+ // opportunity to process the text.
+ return $matches[1];
+ }
+
+
return $this->storeRenderedHyperlink($matches[1]);
}

File Metadata

Mime Type
text/plain
Expires
Fri, Oct 25, 4:11 AM (1 w, 4 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6719771
Default Alt Text
D12691.id.diff (1 KB)

Event Timeline