diff options
| author | Hecklezz <tj8@live.com.au> | 2026-02-26 17:45:22 +1000 |
|---|---|---|
| committer | Andrey Kleshchev <117672381+akleshchev@users.noreply.github.com> | 2026-03-20 20:33:56 +0200 |
| commit | e9b39bf4cde6e8db7ee4475995074a5c06d01007 (patch) | |
| tree | 172cdd6b56ca31415c918cb20f1cc9e9a36e4d32 | |
| parent | 69cbb4869e2804d0cd063eaa1d352824e13604fa (diff) | |
Improve detection of marketplace urls for the marketplace floater
| -rw-r--r-- | indra/newview/llfloatermarketplace.cpp | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/indra/newview/llfloatermarketplace.cpp b/indra/newview/llfloatermarketplace.cpp index bb2378d864..a80546595c 100644 --- a/indra/newview/llfloatermarketplace.cpp +++ b/indra/newview/llfloatermarketplace.cpp @@ -101,6 +101,22 @@ void LLFloaterMarketplace::openMarketplaceURL(const std::string& url) // static bool LLFloaterMarketplace::isMarketplaceURL(const std::string& url) { + auto trimURL = [](std::string_view url) -> std::string_view + { + if (url.starts_with("https://")) + url.remove_prefix(8); + else if (url.starts_with("http://")) + url.remove_prefix(7); + + while (!url.empty() && url.back() == '/') + url.remove_suffix(1); + + return url; + }; + static LLCachedControl<std::string> marketplace_url(gSavedSettings, "MarketplaceURL", "https://marketplace.secondlife.com/"); - return url.starts_with(marketplace_url()); + std::string_view marketplace_url_trimmed = trimURL(marketplace_url()); + std::string_view url_trimmed = trimURL(url); + + return !marketplace_url_trimmed.empty() && url_trimmed.starts_with(marketplace_url_trimmed); } |
