From 99bf150059fea3f0856e376fba66e5f9d6a4abe7 Mon Sep 17 00:00:00 2001 From: Mnikolenko ProductEngine Date: Thu, 16 Oct 2014 10:41:03 +0300 Subject: MAINT-4582 FIXED Certain URLs which end contain secondlife.com or lindenlab.com incorrectly open the Place Profile floater --- indra/llui/llurlentry.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'indra/llui/llurlentry.cpp') diff --git a/indra/llui/llurlentry.cpp b/indra/llui/llurlentry.cpp index c06d6144b9..cc7956078d 100755 --- a/indra/llui/llurlentry.cpp +++ b/indra/llui/llurlentry.cpp @@ -368,6 +368,15 @@ std::string LLUrlEntrySeconlifeURL::getTooltip(const std::string &url) const return url; } +std::string LLUrlEntrySeconlifeURL::getUrl(const std::string &string) const +{ + if (string.find("://") == std::string::npos) + { + return "http://" + escapeUrl(string); + } + return escapeUrl(string); +} + // // LLUrlEntryAgent Describes a Second Life agent Url, e.g., // secondlife:///app/agent/0e346d8b-4433-4d66-a6b0-fd37083abc4c/about -- cgit v1.2.3 From 2b8827a55f6a935bac8abb7513be1c00659f6ab1 Mon Sep 17 00:00:00 2001 From: maksymsproductengine Date: Mon, 13 Oct 2014 19:14:42 +0300 Subject: MAINT-4169 FIXED Suppress initial display of the path portion of URLs from other users and scripts --- indra/llui/llurlentry.cpp | 97 ++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 87 insertions(+), 10 deletions(-) (limited to 'indra/llui/llurlentry.cpp') diff --git a/indra/llui/llurlentry.cpp b/indra/llui/llurlentry.cpp index cc7956078d..daed158fe9 100755 --- a/indra/llui/llurlentry.cpp +++ b/indra/llui/llurlentry.cpp @@ -43,12 +43,16 @@ #define APP_HEADER_REGEX "((x-grid-location-info://[-\\w\\.]+/app)|(secondlife:///app))" +extern LLControlGroup gSavedSettings; + // Utility functions std::string localize_slapp_label(const std::string& url, const std::string& full_name); LLUrlEntryBase::LLUrlEntryBase() -{} +{ + mGreyQuery = gSavedSettings.getBOOL("HTTPNoProtocolShowGreyQuery"); +} LLUrlEntryBase::~LLUrlEntryBase() { @@ -187,6 +191,33 @@ bool LLUrlEntryBase::isWikiLinkCorrect(std::string url) return (LLUrlRegistry::instance().hasUrl(label)) ? false : true; } +std::string LLUrlEntryBase::urlToLabelWithGreyQuery(const std::string &url) const +{ + LLUriParser up(unescapeUrl(url)); + up.normalize(); + + std::string label; + up.extractParts(); + up.glueFirst(label); + + return label; +} + +std::string LLUrlEntryBase::urlToGreyQuery(const std::string &url) const +{ + LLUriParser up(unescapeUrl(url)); + + std::string query; + if (mGreyQuery) + { + up.extractParts(); + up.glueSecond(query); + } + + return query; +} + + static std::string getStringAfterToken(const std::string str, const std::string token) { size_t pos = str.find(token); @@ -203,6 +234,7 @@ static std::string getStringAfterToken(const std::string str, const std::string // LLUrlEntryHTTP Describes generic http: and https: Urls // LLUrlEntryHTTP::LLUrlEntryHTTP() + : LLUrlEntryBase() { mPattern = boost::regex("https?://([-\\w\\.]+)+(:\\d+)?(:\\w+)?(@\\d+)?(@\\w+)?/?\\S*", boost::regex::perl|boost::regex::icase); @@ -211,6 +243,25 @@ LLUrlEntryHTTP::LLUrlEntryHTTP() } std::string LLUrlEntryHTTP::getLabel(const std::string &url, const LLUrlLabelCallback &cb) +{ + return urlToLabelWithGreyQuery(url); +} + +std::string LLUrlEntryHTTP::getQuery(const std::string &url) const +{ + return urlToGreyQuery(url); +} + +std::string LLUrlEntryHTTP::getUrl(const std::string &string) const +{ + if (string.find("://") == std::string::npos) + { + return "http://" + escapeUrl(string); + } + return escapeUrl(string); +} + +std::string LLUrlEntryHTTP::getTooltip(const std::string &url) const { return unescapeUrl(url); } @@ -247,6 +298,7 @@ std::string LLUrlEntryHTTPLabel::getUrl(const std::string &string) const // LLUrlEntryHTTPNoProtocol Describes generic Urls like www.google.com // LLUrlEntryHTTPNoProtocol::LLUrlEntryHTTPNoProtocol() + : LLUrlEntryBase() { mPattern = boost::regex("(" "\\bwww\\.\\S+\\.\\S+" // i.e. www.FOO.BAR @@ -260,7 +312,12 @@ LLUrlEntryHTTPNoProtocol::LLUrlEntryHTTPNoProtocol() std::string LLUrlEntryHTTPNoProtocol::getLabel(const std::string &url, const LLUrlLabelCallback &cb) { - return unescapeUrl(url); + return urlToLabelWithGreyQuery(url); +} + +std::string LLUrlEntryHTTPNoProtocol::getQuery(const std::string &url) const +{ + return urlToGreyQuery(url); } std::string LLUrlEntryHTTPNoProtocol::getUrl(const std::string &string) const @@ -272,6 +329,11 @@ std::string LLUrlEntryHTTPNoProtocol::getUrl(const std::string &string) const return escapeUrl(string); } +std::string LLUrlEntryHTTPNoProtocol::getTooltip(const std::string &url) const +{ + return unescapeUrl(url); +} + // // LLUrlEntrySLURL Describes generic http: and https: Urls // @@ -345,30 +407,33 @@ std::string LLUrlEntrySLURL::getLocation(const std::string &url) const } // -// LLUrlEntrySeconlifeURLs Describes *secondlife.com and *lindenlab.com urls to substitute icon 'hand.png' before link +// LLUrlEntrySeconlifeURL Describes *secondlife.com/ and *lindenlab.com/ urls to substitute icon 'hand.png' before link // -LLUrlEntrySeconlifeURL::LLUrlEntrySeconlifeURL() -{ - mPattern = boost::regex("\\b(https?://)?([-\\w\\.]*\\.)?(secondlife|lindenlab)\\.com(:\\d{1,5})?(/\\S*)?\\b", +LLUrlEntrySecondlifeURL::LLUrlEntrySecondlifeURL() +{ + mPattern = boost::regex("(https?://)?([-\\w\\.]*\\.)?(secondlife|lindenlab)\\.com(:\\d{1,5})?\\/\\S*", boost::regex::perl|boost::regex::icase); mIcon = "Hand"; mMenuName = "menu_url_http.xml"; } -std::string LLUrlEntrySeconlifeURL::getLabel(const std::string &url, const LLUrlLabelCallback &cb) +std::string LLUrlEntrySecondlifeURL::getLabel(const std::string &url, const LLUrlLabelCallback &cb) { LLUriParser up(url); up.extractParts(); - return up.host(); + + std::string label; + up.glueFirst(label); + return label; } -std::string LLUrlEntrySeconlifeURL::getTooltip(const std::string &url) const +std::string LLUrlEntrySecondlifeURL::getTooltip(const std::string &url) const { return url; } -std::string LLUrlEntrySeconlifeURL::getUrl(const std::string &string) const +std::string LLUrlEntrySecondlifeURL::getUrl(const std::string &string) const { if (string.find("://") == std::string::npos) { @@ -377,6 +442,18 @@ std::string LLUrlEntrySeconlifeURL::getUrl(const std::string &string) const return escapeUrl(string); } +// +// LLUrlEntrySimpleSecondlifeURL Describes *secondlife.com and *lindenlab.com urls to substitute icon 'hand.png' before link +// +LLUrlEntrySimpleSecondlifeURL::LLUrlEntrySimpleSecondlifeURL() + { + mPattern = boost::regex("(https?://)?([-\\w\\.]*\\.)?(secondlife|lindenlab)\\.com(?!\\S)", + boost::regex::perl|boost::regex::icase); + + mIcon = "Hand"; + mMenuName = "menu_url_http.xml"; +} + // // LLUrlEntryAgent Describes a Second Life agent Url, e.g., // secondlife:///app/agent/0e346d8b-4433-4d66-a6b0-fd37083abc4c/about -- cgit v1.2.3 From c8cfcf8ea171b32185dbac12e576339b9ec4179a Mon Sep 17 00:00:00 2001 From: maksymsproductengine Date: Thu, 16 Oct 2014 17:27:44 +0300 Subject: Fix build issues. --- indra/llui/llurlentry.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'indra/llui/llurlentry.cpp') diff --git a/indra/llui/llurlentry.cpp b/indra/llui/llurlentry.cpp index daed158fe9..ac023e664d 100755 --- a/indra/llui/llurlentry.cpp +++ b/indra/llui/llurlentry.cpp @@ -43,15 +43,13 @@ #define APP_HEADER_REGEX "((x-grid-location-info://[-\\w\\.]+/app)|(secondlife:///app))" -extern LLControlGroup gSavedSettings; - // Utility functions std::string localize_slapp_label(const std::string& url, const std::string& full_name); LLUrlEntryBase::LLUrlEntryBase() { - mGreyQuery = gSavedSettings.getBOOL("HTTPNoProtocolShowGreyQuery"); + mGreyQuery = LLUI::sSettingGroups["config"]->getBOOL("HTTPNoProtocolShowGreyQuery"); } LLUrlEntryBase::~LLUrlEntryBase() -- cgit v1.2.3 From 28e8b8ecdbf7a5aecf9e0dec2e673e832baf642f Mon Sep 17 00:00:00 2001 From: Mnikolenko ProductEngine Date: Thu, 4 Dec 2014 12:40:13 +0200 Subject: MAINT-4683 FIXED Display SLURLs with incorrect coordinates as regular URLs. --- indra/llui/llurlentry.cpp | 85 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) (limited to 'indra/llui/llurlentry.cpp') diff --git a/indra/llui/llurlentry.cpp b/indra/llui/llurlentry.cpp index ac023e664d..adf010cd5d 100755 --- a/indra/llui/llurlentry.cpp +++ b/indra/llui/llurlentry.cpp @@ -332,6 +332,90 @@ std::string LLUrlEntryHTTPNoProtocol::getTooltip(const std::string &url) const return unescapeUrl(url); } +LLUrlEntryInvalidSLURL::LLUrlEntryInvalidSLURL() + : LLUrlEntryBase() +{ + mPattern = boost::regex("(http://(maps.secondlife.com|slurl.com)/secondlife/|secondlife://(/app/(worldmap|teleport)/)?)[^ /]+(/-?[0-9]+){1,3}(/?(\\?title|\\?img|\\?msg)=\\S*)?/?", + boost::regex::perl|boost::regex::icase); + mMenuName = "menu_url_http.xml"; + mTooltip = LLTrans::getString("TooltipHttpUrl"); +} + +std::string LLUrlEntryInvalidSLURL::getLabel(const std::string &url, const LLUrlLabelCallback &cb) +{ + + return escapeUrl(url); +} + +std::string LLUrlEntryInvalidSLURL::getUrl(const std::string &string) const +{ + return escapeUrl(string); +} + +std::string LLUrlEntryInvalidSLURL::getTooltip(const std::string &url) const +{ + return unescapeUrl(url); +} + +bool LLUrlEntryInvalidSLURL::isSLURLvalid(const std::string &url) const +{ + S32 actual_parts; + + if(url.find(".com/secondlife/") != std::string::npos) + { + actual_parts = 5; + } + else if(url.find("/app/") != std::string::npos) + { + actual_parts = 6; + } + else + { + actual_parts = 3; + } + + LLURI uri(url); + LLSD path_array = uri.pathArray(); + S32 path_parts = path_array.size(); + S32 x,y,z; + + if (path_parts == actual_parts) + { + // handle slurl with (X,Y,Z) coordinates + LLStringUtil::convertToS32(path_array[path_parts-3],x); + LLStringUtil::convertToS32(path_array[path_parts-2],y); + LLStringUtil::convertToS32(path_array[path_parts-1],z); + + if((x>= 0 && x<= 256) && (y>= 0 && y<= 256) && (z>= 0)) + { + return TRUE; + } + } + else if (path_parts == (actual_parts-1)) + { + // handle slurl with (X,Y) coordinates + + LLStringUtil::convertToS32(path_array[path_parts-2],x); + LLStringUtil::convertToS32(path_array[path_parts-1],y); + ; + if((x>= 0 && x<= 256) && (y>= 0 && y<= 256)) + { + return TRUE; + } + } + else if (path_parts == (actual_parts-2)) + { + // handle slurl with (X) coordinate + LLStringUtil::convertToS32(path_array[path_parts-1],x); + if(x>= 0 && x<= 256) + { + return TRUE; + } + } + + return FALSE; +} + // // LLUrlEntrySLURL Describes generic http: and https: Urls // @@ -353,6 +437,7 @@ std::string LLUrlEntrySLURL::getLabel(const std::string &url, const LLUrlLabelCa // - http://slurl.com/secondlife/Place/X // - http://slurl.com/secondlife/Place // + LLURI uri(url); LLSD path_array = uri.pathArray(); S32 path_parts = path_array.size(); -- cgit v1.2.3 From bf5145422384386cdb31429ad01d79f7719161a5 Mon Sep 17 00:00:00 2001 From: Mnikolenko ProductEngine Date: Fri, 9 Jan 2015 12:10:32 +0200 Subject: MAINT-4169 FIXED grey out all but domain name in SL-links, same as it's done for non-Linden URLs --- indra/llui/llurlentry.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'indra/llui/llurlentry.cpp') diff --git a/indra/llui/llurlentry.cpp b/indra/llui/llurlentry.cpp index adf010cd5d..acc8fdacfb 100755 --- a/indra/llui/llurlentry.cpp +++ b/indra/llui/llurlentry.cpp @@ -49,7 +49,7 @@ std::string localize_slapp_label(const std::string& url, const std::string& full LLUrlEntryBase::LLUrlEntryBase() { - mGreyQuery = LLUI::sSettingGroups["config"]->getBOOL("HTTPNoProtocolShowGreyQuery"); + mGreyQuery = LLUI::sSettingGroups["config"]->getBOOL("ShowGreyQueryInUrls"); } LLUrlEntryBase::~LLUrlEntryBase() @@ -503,12 +503,12 @@ LLUrlEntrySecondlifeURL::LLUrlEntrySecondlifeURL() std::string LLUrlEntrySecondlifeURL::getLabel(const std::string &url, const LLUrlLabelCallback &cb) { - LLUriParser up(url); - up.extractParts(); + return urlToLabelWithGreyQuery(url); +} - std::string label; - up.glueFirst(label); - return label; +std::string LLUrlEntrySecondlifeURL::getQuery(const std::string &url) const +{ + return urlToGreyQuery(url); } std::string LLUrlEntrySecondlifeURL::getTooltip(const std::string &url) const -- cgit v1.2.3 From f097c731d654b2fbcb73ee0bbf5b7263be109e23 Mon Sep 17 00:00:00 2001 From: Mnikolenko ProductEngine Date: Wed, 4 Mar 2015 13:10:58 +0200 Subject: MAINT-4169 ShowGreyQueryInUrls debug setting was removed and the grey part of the link always appears. --- indra/llui/llurlentry.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'indra/llui/llurlentry.cpp') diff --git a/indra/llui/llurlentry.cpp b/indra/llui/llurlentry.cpp index acc8fdacfb..e18d7405ab 100755 --- a/indra/llui/llurlentry.cpp +++ b/indra/llui/llurlentry.cpp @@ -49,7 +49,6 @@ std::string localize_slapp_label(const std::string& url, const std::string& full LLUrlEntryBase::LLUrlEntryBase() { - mGreyQuery = LLUI::sSettingGroups["config"]->getBOOL("ShowGreyQueryInUrls"); } LLUrlEntryBase::~LLUrlEntryBase() @@ -206,11 +205,8 @@ std::string LLUrlEntryBase::urlToGreyQuery(const std::string &url) const LLUriParser up(unescapeUrl(url)); std::string query; - if (mGreyQuery) - { - up.extractParts(); - up.glueSecond(query); - } + up.extractParts(); + up.glueSecond(query); return query; } -- cgit v1.2.3 From 5a282abe184323643f1a88f2aba662648059b4e2 Mon Sep 17 00:00:00 2001 From: Cinder Date: Sat, 11 Apr 2015 15:23:06 -0600 Subject: STORM-2113 - uri parsing cleanup and fixes --- indra/llui/llurlentry.cpp | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) (limited to 'indra/llui/llurlentry.cpp') diff --git a/indra/llui/llurlentry.cpp b/indra/llui/llurlentry.cpp index 7e4104c49b..52e6965f33 100755 --- a/indra/llui/llurlentry.cpp +++ b/indra/llui/llurlentry.cpp @@ -39,8 +39,6 @@ #include "lluicolortable.h" #include "message.h" -#include "uriparser/Uri.h" - #define APP_HEADER_REGEX "((x-grid-location-info://[-\\w\\.]+/app)|(secondlife:///app))" // Utility functions @@ -347,27 +345,36 @@ std::string LLUrlEntrySLURL::getLocation(const std::string &url) const // // LLUrlEntrySeconlifeURLs Describes *secondlife.com and *lindenlab.com urls to substitute icon 'hand.png' before link // -LLUrlEntrySeconlifeURL::LLUrlEntrySeconlifeURL() +LLUrlEntrySecondlifeURL::LLUrlEntrySecondlifeURL() { mPattern = boost::regex("\\b(https?://)?([-\\w\\.]*\\.)?(secondlife|lindenlab)\\.com(:\\d{1,5})?(/\\S*)?\\b", boost::regex::perl|boost::regex::icase); mIcon = "Hand"; mMenuName = "menu_url_http.xml"; + mTooltip = LLTrans::getString("TooltipHttpUrl"); } -std::string LLUrlEntrySeconlifeURL::getLabel(const std::string &url, const LLUrlLabelCallback &cb) +/// Return the url from a string that matched the regex +std::string LLUrlEntrySecondlifeURL::getUrl(const std::string &string) const { - LLUriParser up(url); - up.extractParts(); - return up.host(); + if (string.find("://") == std::string::npos) + { + return "https://" + escapeUrl(string); + } + return escapeUrl(string); } -std::string LLUrlEntrySeconlifeURL::getTooltip(const std::string &url) const +std::string LLUrlEntrySecondlifeURL::getLabel(const std::string &url, const LLUrlLabelCallback &cb) { return url; } +std::string LLUrlEntrySecondlifeURL::getTooltip(const std::string &url) const +{ + return mTooltip; +} + // // LLUrlEntryAgent Describes a Second Life agent Url, e.g., // secondlife:///app/agent/0e346d8b-4433-4d66-a6b0-fd37083abc4c/about -- cgit v1.2.3