Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15400539
D18666.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D18666.id.diff
View Options
diff --git a/src/markup/engine/__tests__/remarkup/link-with-angle-link-anchor.txt b/src/markup/engine/__tests__/remarkup/link-with-angle-link-anchor.txt
new file mode 100644
--- /dev/null
+++ b/src/markup/engine/__tests__/remarkup/link-with-angle-link-anchor.txt
@@ -0,0 +1,5 @@
+<http://x.y#http://x.y#>
+~~~~~~~~~~
+<p><http://x.y#http://x.y#></p>
+~~~~~~~~~~
+<http://x.y#http://x.y#>
diff --git a/src/markup/engine/__tests__/remarkup/link-with-link-anchor.txt b/src/markup/engine/__tests__/remarkup/link-with-link-anchor.txt
new file mode 100644
--- /dev/null
+++ b/src/markup/engine/__tests__/remarkup/link-with-link-anchor.txt
@@ -0,0 +1,5 @@
+http://x.y#http://x.y#
+~~~~~~~~~~
+<p>http://x.y#http://x.y#</p>
+~~~~~~~~~~
+http://x.y#http://x.y#
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
@@ -32,11 +32,18 @@
}
protected function markupHyperlink(array $matches) {
+ try {
+ $uri = new PhutilURI($matches[1]);
+ } catch (Exception $ex) {
+ return $matches[0];
+ }
+
+ $protocol = $uri->getProtocol();
+
$protocols = $this->getEngine()->getConfig(
'uri.allowed-protocols',
array());
- $protocol = id(new PhutilURI($matches[1]))->getProtocol();
if (!idx($protocols, $protocol)) {
// If this URI doesn't use a whitelisted protocol, don't link it. This
// is primarily intended to prevent javascript:// silliness.
@@ -102,6 +109,12 @@
$match = substr($match, 0, -1);
}
+ try {
+ $uri = new PhutilURI($match);
+ } catch (Exception $ex) {
+ return $matches[0];
+ }
+
return hsprintf('%s%s', $this->markupHyperlink(array(null, $match)), $tail);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Mar 18, 12:24 PM (5 d, 3 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7221680
Default Alt Text
D18666.id.diff (1 KB)
Attached To
Mode
D18666: Fix an exception in the hyperlink remarkup rule for unparseable URIs
Attached
Detach File
Event Timeline
Log In to Comment