From d957198fd65257f4ac3736d2492b7ee4c47cefdb Mon Sep 17 00:00:00 2001
From: Cynser <42423063+Cynser@users.noreply.github.com>
Date: Sun, 7 Oct 2018 22:52:08 +0100
Subject: [PATCH 1/2] Make the check for Wikipedia URLs slightly stricter
---
src/web/HTMLOperation.mjs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/web/HTMLOperation.mjs b/src/web/HTMLOperation.mjs
index 5d12470847..c20defef6d 100755
--- a/src/web/HTMLOperation.mjs
+++ b/src/web/HTMLOperation.mjs
@@ -131,7 +131,7 @@ class HTMLOperation {
*/
function titleFromWikiLink(url) {
const splitURL = url.split("/");
- if (splitURL.indexOf("wiki") < 0) {
+ if (splitURL.indexOf("wikipedia.org") < 0) {
// Not a wiki link, return full URL
return `More Informationopen_in_new`;
}
From 98d861a63939a9ecf3153ced658f98c27b83d5d7 Mon Sep 17 00:00:00 2001
From: Cynser <42423063+Cynser@users.noreply.github.com>
Date: Thu, 11 Oct 2018 17:27:51 +0100
Subject: [PATCH 2/2] Add check for Forensics Wiki URLs
---
src/web/HTMLOperation.mjs | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/web/HTMLOperation.mjs b/src/web/HTMLOperation.mjs
index c20defef6d..5373113a76 100755
--- a/src/web/HTMLOperation.mjs
+++ b/src/web/HTMLOperation.mjs
@@ -131,14 +131,16 @@ class HTMLOperation {
*/
function titleFromWikiLink(url) {
const splitURL = url.split("/");
- if (splitURL.indexOf("wikipedia.org") < 0) {
+ if (splitURL.indexOf("wikipedia.org") < 0 && splitURL.indexOf("forensicswiki.org") < 0) {
// Not a wiki link, return full URL
return `More Informationopen_in_new`;
}
+ const wikiName = splitURL.indexOf("forensicswiki.org") < 0 ? "Wikipedia" : "Forensics Wiki";
+
const pageTitle = decodeURIComponent(splitURL[splitURL.length - 1])
.replace(/_/g, " ");
- return `${pageTitle}open_in_new on Wikipedia`;
+ return `${pageTitle}open_in_new on ${wikiName}`;
}
export default HTMLOperation;