Bug 1274242 - Linkify should not stop at |. r=valentin
--- a/netwerk/streamconv/converters/mozTXTToHTMLConv.cpp
+++ b/netwerk/streamconv/converters/mozTXTToHTMLConv.cpp
@@ -303,17 +303,16 @@ mozTXTToHTMLConv::FindURLEnd(const char1
bool seenOpeningParenthesis = false; // there is a '(' earlier in the URL
bool seenOpeningSquareBracket = false; // there is a '[' earlier in the URL
for (; int32_t(i) < aInStringLength; i++)
{
// These chars mark the end of the URL
if (aInString[i] == '>' || aInString[i] == '<' ||
aInString[i] == '"' || aInString[i] == '`' ||
aInString[i] == '}' || aInString[i] == '{' ||
- aInString[i] == '|' ||
(aInString[i] == ')' && !seenOpeningParenthesis) ||
(aInString[i] == ']' && !seenOpeningSquareBracket) ||
// Allow IPv6 adresses like http://[1080::8:800:200C:417A]/foo.
(aInString[i] == '[' && i > 2 &&
(aInString[i - 1] != '/' || aInString[i - 2] != '/')) ||
IsSpace(aInString[i]))
break;
// Disallow non-ascii-characters for email.
--- a/netwerk/test/unit/test_mozTXTToHTMLConv.js
+++ b/netwerk/test/unit/test_mozTXTToHTMLConv.js
@@ -105,16 +105,20 @@ function run_test() {
},
{
input: "ipv6 2: http://[::ffff:127.0.0.1]/#yay test",
url: "http://[::ffff:127.0.0.1]/#yay"
},
{
input: "ipv6 parenthesis port: (http://[2001:db8::1]:80/) test",
url: "http://[2001:db8::1]:80/"
+ },
+ {
+ input: "test http://www.map.com/map.php?t=Nova_Scotia&markers=//Not_a_survey||description=plm2 test",
+ url: "http://www.map.com/map.php?t=Nova_Scotia&markers=//Not_a_survey||description=plm2"
}
];
const scanHTMLtests = [
{
input: "http://foo.example.com",
shouldChange: true
},