diff options
author | Andrew Dyukov <adyukov@productengine.com> | 2010-02-22 19:22:43 +0200 |
---|---|---|
committer | Andrew Dyukov <adyukov@productengine.com> | 2010-02-22 19:22:43 +0200 |
commit | 16b284971ebb6ecb41ba65d5fd9da87bc08bcba3 (patch) | |
tree | 8f878d54bb806b4783d24d87f9a456b0cb03bc6c /indra/newview/llslurl.cpp | |
parent | a7d716c35e57881a016c69752fa5f46dfd314ad9 (diff) |
Fixed normal bug EXT-4964 (Invalid SLURL detection does not detect invalid slurls).
- Added new static method LLSLURL::isValidSLURL() whic uses LLUrlRegistry::isUrl() to validate SLURLs and not just chek prefixes as LLSLURL::isSLURL() does.
- Used it in slurl DnD check in LLViewerWindow.
- LLUrlEntrySLURL regexp was changed not to pass non-valid SLURLS (such as one from the bug description).
--HG--
branch : product-engine
Diffstat (limited to 'indra/newview/llslurl.cpp')
-rw-r--r-- | indra/newview/llslurl.cpp | 16 |
1 files changed, 16 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) { |