From f714c666d9498710a7afff49e7653eb7c3e97d56 Mon Sep 17 00:00:00 2001 From: SimonBrazell Date: Fri, 16 Apr 2021 13:02:18 +1000 Subject: [PATCH] Fixes #135 - Handle Twitter usernames with "tweets" in them. --- src/pages/background/background.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/pages/background/background.js b/src/pages/background/background.js index 6217903..ce004db 100644 --- a/src/pages/background/background.js +++ b/src/pages/background/background.js @@ -290,7 +290,7 @@ function redirectTwitter(url, initiator) { if (disableNitter || isException(url, initiator)) { return null; } - if (url.pathname.includes("/home")) { + if (url.pathname.split("/").includes("home")) { return null; } if ( @@ -313,7 +313,7 @@ function redirectTwitter(url, initiator) { return `${ nitterInstance || commonHelper.getRandomInstance(nitterRandomPool) }/gif/${encodeURIComponent(url.href)}`; - } else if (url.pathname.includes("tweets")) { + } else if (url.pathname.split("/").includes("tweets")) { return `${ nitterInstance || commonHelper.getRandomInstance(nitterRandomPool) }${url.pathname.replace("/tweets", "")}${url.search}`; @@ -379,7 +379,7 @@ function redirectGoogleMaps(url, initiator) { layers[url.searchParams.get("layer")] || layers["none"] }`; // Handle Google Maps Embed API - if (url.pathname.includes("/embed")) { + if (url.pathname.split("/").includes("embed")) { let query = ""; if (url.searchParams.has("q")) { query = url.searchParams.get("q"); @@ -400,7 +400,7 @@ function redirectGoogleMaps(url, initiator) { }); redirect = `${osmInstance}/export/embed.html?bbox=${bbox}&layer=mapnik&marker=${marker}`; // Handle Google Maps Directions - } else if (url.pathname.includes("/dir")) { + } else if (url.pathname.split("/").includes("dir")) { const travelMode = travelModes[url.searchParams.get("travelmode")] || travelModes["driving"]; let origin;