diff options
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llslurl.cpp | 16 | ||||
-rw-r--r-- | indra/newview/llslurl.h | 5 | ||||
-rw-r--r-- | indra/newview/llviewerwindow.cpp | 2 |
3 files changed, 23 insertions, 0 deletions
diff --git a/indra/newview/llslurl.cpp b/indra/newview/llslurl.cpp index e4773f99c5..5d20e280b5 100644 --- a/indra/newview/llslurl.cpp +++ b/indra/newview/llslurl.cpp @@ -36,6 +36,8 @@ #include "llweb.h" +#include "llurlregistry.h" + const std::string LLSLURL::PREFIX_SL_HELP = "secondlife://app."; const std::string LLSLURL::PREFIX_SL = "sl://"; const std::string LLSLURL::PREFIX_SECONDLIFE = "secondlife://"; @@ -95,6 +97,20 @@ bool LLSLURL::isSLURL(const std::string& url) return false; } +bool LLSLURL::isValidSLURL(const std::string& url) +{ + std::string temp_url(url); + //"www." may appear in DnD- see description of PREFIX_SLURL_WWW. + // If it is found, we remove it because it isn't expected in regexp. + if (matchPrefix(url, PREFIX_SLURL_WWW)) + { + size_t position = url.find("www."); + temp_url.erase(position,4); + } + + return LLUrlRegistry::getInstance()->isUrl(temp_url); +} + // static bool LLSLURL::isSLURLCommand(const std::string& url) { diff --git a/indra/newview/llslurl.h b/indra/newview/llslurl.h index 6a695e84f3..a79a8fc97c 100644 --- a/indra/newview/llslurl.h +++ b/indra/newview/llslurl.h @@ -61,6 +61,11 @@ public: static bool isSLURL(const std::string& url); /** + * Returns true if url is proven valid by regexp check from LLUrlRegistry + */ + static bool isValidSLURL(const std::string& url); + + /** * Is this a special secondlife://app/ URL? */ static bool isSLURLCommand(const std::string& url); diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 1acf114b12..591b1de509 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -826,6 +826,8 @@ LLWindowCallbacks::DragNDropResult LLViewerWindow::handleDragNDrop( LLWindow *wi if (slurl_dnd_enabled) { + // isValidSLURL() call was added here to make sure that dragged SLURL is valid (EXT-4964) + if ( LLSLURL::isSLURL( data ) && LLSLURL::isValidSLURL( data ) ) // special case SLURLs if ( LLSLURL::isSLURL( data ) ) { |