From f153aa3daf2e70b6da8c113b55afff10af1f5fae Mon Sep 17 00:00:00 2001 From: AndreyL ProductEngine Date: Wed, 8 Jul 2015 06:15:27 +0300 Subject: MAINT-5371 FIXED Undesired space added to SL and LL domains sent in chat --- indra/llui/llurlregistry.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'indra/llui/llurlregistry.cpp') diff --git a/indra/llui/llurlregistry.cpp b/indra/llui/llurlregistry.cpp index 2085505947..5ad05a1c86 100755 --- a/indra/llui/llurlregistry.cpp +++ b/indra/llui/llurlregistry.cpp @@ -218,6 +218,10 @@ bool LLUrlRegistry::findUrl(const std::string &text, LLUrlMatch &match, const LL // did we find a match? if so, return its details in the match object if (match_entry) { + // Skip if link is an email. See MAINT-5371. + if (match_start > 0 && text.substr(match_start - 1, 1) == "@") + return false; + // fill in the LLUrlMatch object and return it std::string url = text.substr(match_start, match_end - match_start + 1); -- cgit v1.2.3 From 078612e292fa8b66a8b7a68b7e1fe9b5049c3deb Mon Sep 17 00:00:00 2001 From: AndreyL ProductEngine Date: Tue, 14 Jul 2015 04:39:20 +0300 Subject: MAINT-5019 FIXED Additional cases --- indra/llui/llurlregistry.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'indra/llui/llurlregistry.cpp') diff --git a/indra/llui/llurlregistry.cpp b/indra/llui/llurlregistry.cpp index 5ad05a1c86..fcdb5b19d4 100755 --- a/indra/llui/llurlregistry.cpp +++ b/indra/llui/llurlregistry.cpp @@ -76,9 +76,10 @@ LLUrlRegistry::LLUrlRegistry() registerUrl(new LLUrlEntrySL()); mUrlEntrySLLabel = new LLUrlEntrySLLabel(); registerUrl(mUrlEntrySLLabel); - // most common pattern is a URL without any protocol, - // e.g., "secondlife.com" + // most common pattern is a URL without any protocol starting with "www", + // e.g., "www.secondlife.com" registerUrl(new LLUrlEntryHTTPNoProtocol()); + registerUrl(new LLUrlEntryEmail()); } LLUrlRegistry::~LLUrlRegistry() @@ -155,11 +156,9 @@ static bool stringHasUrl(const std::string &text) return (text.find("://") != std::string::npos || text.find("www.") != std::string::npos || text.find(".com") != std::string::npos || - text.find(".net") != std::string::npos || - text.find(".edu") != std::string::npos || - text.find(".org") != std::string::npos || text.find("") != std::string::npos || - text.find(" 0 && text.substr(match_start - 1, 1) == "@") return false; -- cgit v1.2.3 From e62d5ea4e822e7bb2204eca25c8c4a87a9f6b4be Mon Sep 17 00:00:00 2001 From: AndreyL ProductEngine Date: Wed, 29 Jul 2015 07:35:08 +0300 Subject: MAINT-5019 FIXED Undesired "http://" added to domains sent in chat Completely removed matching of the URLs w/o a protocol + Some unit tests --- indra/llui/llurlregistry.cpp | 3 --- 1 file changed, 3 deletions(-) (limited to 'indra/llui/llurlregistry.cpp') diff --git a/indra/llui/llurlregistry.cpp b/indra/llui/llurlregistry.cpp index fcdb5b19d4..decb9c9bc2 100755 --- a/indra/llui/llurlregistry.cpp +++ b/indra/llui/llurlregistry.cpp @@ -76,9 +76,6 @@ LLUrlRegistry::LLUrlRegistry() registerUrl(new LLUrlEntrySL()); mUrlEntrySLLabel = new LLUrlEntrySLLabel(); registerUrl(mUrlEntrySLLabel); - // most common pattern is a URL without any protocol starting with "www", - // e.g., "www.secondlife.com" - registerUrl(new LLUrlEntryHTTPNoProtocol()); registerUrl(new LLUrlEntryEmail()); } -- cgit v1.2.3 From d04a3b6d4e67dafa0b6dd8e88b752c5a929de5b0 Mon Sep 17 00:00:00 2001 From: Mnikolenko ProductEngine Date: Fri, 31 Jul 2015 12:27:36 +0300 Subject: MAINT-5127 FIXED Maps URLs copied from gcal inherit special characters that do odd things --- indra/llui/llurlregistry.cpp | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) (limited to 'indra/llui/llurlregistry.cpp') diff --git a/indra/llui/llurlregistry.cpp b/indra/llui/llurlregistry.cpp index decb9c9bc2..69eefa736c 100755 --- a/indra/llui/llurlregistry.cpp +++ b/indra/llui/llurlregistry.cpp @@ -214,6 +214,7 @@ bool LLUrlRegistry::findUrl(const std::string &text, LLUrlMatch &match, const LL // did we find a match? if so, return its details in the match object if (match_entry) { + // Skip if link is an email with an empty username (starting with @). See MAINT-5371. if (match_start > 0 && text.substr(match_start - 1, 1) == "@") return false; @@ -221,6 +222,32 @@ bool LLUrlRegistry::findUrl(const std::string &text, LLUrlMatch &match, const LL // fill in the LLUrlMatch object and return it std::string url = text.substr(match_start, match_end - match_start + 1); + LLUrlEntryBase *stripped_entry = NULL; + if(LLStringUtil::containsNonprintable(url)) + { + LLStringUtil::stripNonprintable(url); + + std::vector::iterator iter; + for (iter = mUrlEntry.begin(); iter != mUrlEntry.end(); ++iter) + { + LLUrlEntryBase *url_entry = *iter; + U32 start = 0, end = 0; + if (matchRegex(url.c_str(), url_entry->getPattern(), start, end)) + { + if (mLLUrlEntryInvalidSLURL == *iter) + { + if(url_entry && url_entry->isSLURLvalid(url)) + { + continue; + } + } + stripped_entry = url_entry; + break; + } + } + } + + if (match_entry == mUrlEntryTrusted) { LLUriParser up(url); @@ -228,10 +255,12 @@ bool LLUrlRegistry::findUrl(const std::string &text, LLUrlMatch &match, const LL url = up.normalizedUri(); } + std::string url_label = stripped_entry? stripped_entry->getLabel(url, cb) : match_entry->getLabel(url, cb); + std::string url_query = stripped_entry? stripped_entry->getQuery(url) : match_entry->getQuery(url); match.setValues(match_start, match_end, match_entry->getUrl(url), - match_entry->getLabel(url, cb), - match_entry->getQuery(url), + url_label, + url_query, match_entry->getTooltip(url), match_entry->getIcon(url), match_entry->getStyle(), -- cgit v1.2.3