From b45677cd02836167b76e31085b5768711c36d1d3 Mon Sep 17 00:00:00 2001 From: howard-stearns Date: Thu, 27 Sep 2018 19:42:01 -0700 Subject: [PATCH] additionally handle item urls (marketplace links from cert inspections) --- scripts/system/marketplaces/marketplaces.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/scripts/system/marketplaces/marketplaces.js b/scripts/system/marketplaces/marketplaces.js index dbb838664a..03ce986821 100644 --- a/scripts/system/marketplaces/marketplaces.js +++ b/scripts/system/marketplaces/marketplaces.js @@ -118,13 +118,16 @@ function openMarketplace(optionalItemOrUrl) { // AND... if call onMarketplaceOpen to setupWallet if we need to. var url = optionalItemOrUrl || MARKETPLACE_URL_INITIAL; var cta = 'marketplace cta'; + var match; + // If optionalItemOrUrl contains the metaverse base, then it's a url, not an item id. if (optionalItemOrUrl && optionalItemOrUrl.indexOf(METAVERSE_SERVER_URL) === -1) { cta = optionalItemOrUrl; // item id url = MARKETPLACE_URL + '/items/' + optionalItemOrUrl; } else if (optionalItemOrUrl) { - // A specific url. Don't attempt to set up wallet because we don't have a way to come back. - // Does that ever happen without the wallet already setup? - cta = ''; + // A specific url. + match = optionalItemOrUrl.match(/\/item\/(\w+)$/); + // Don't attempt to set up wallet for a non-item url because we don't have a way to come back. + cta = (match && match[1]) || ''; } ui.open(url, MARKETPLACES_INJECT_SCRIPT_URL); }