diff options
author | Austin Huang <im@austinhuang.me> | 2022-10-10 04:32:20 +0200 |
---|---|---|
committer | Edward <edwardlangdon@noreply.codeberg.org> | 2022-10-10 04:32:20 +0200 |
commit | 91d420b4606b23d3d8b4105382a6773aa7f26d2a (patch) | |
tree | c448cbff32fdf260c2e57f26bd56f085a0e8c5e7 /src | |
parent | updated instances (diff) | |
download | libredirect-91d420b4606b23d3d8b4105382a6773aa7f26d2a.zip |
Fix regex since Fandom subdomains can contain hyphens (#37)
For example, it wouldn't redirect https://kimetsu-no-yaiba.fandom.com/wiki/Kimetsu_no_Yaiba_Wiki, now it would Reviewed-on: https://codeberg.org/LibRedirect/libredirect/pulls/37 Co-authored-by: Austin Huang <im@austinhuang.me> Co-committed-by: Austin Huang <im@austinhuang.me>
Diffstat (limited to 'src')
-rw-r--r-- | src/assets/javascripts/services.js | 2 | ||||
-rw-r--r-- | src/config/config.json | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/src/assets/javascripts/services.js b/src/assets/javascripts/services.js index 806624d7..017818d8 100644 --- a/src/assets/javascripts/services.js +++ b/src/assets/javascripts/services.js @@ -393,7 +393,7 @@ function redirect(url, type, initiator, forceRedirection) { } return randomInstance case "breezeWiki": - let wiki = url.hostname.match(/^[a-zA-Z0-9]+(?=\.fandom\.com)/) + let wiki = url.hostname.match(/^[a-zA-Z0-9-]+(?=\.fandom\.com)/) if (wiki == "www" || !wiki) wiki = "" else wiki = "/" + wiki if (url.href.search(/Special:Search\?query/) > -1) return `${randomInstance}${wiki}${url.pathname}${url.search}`.replace(/Special:Search\?query/, "search?q").replace(/\/wiki/, "") diff --git a/src/config/config.json b/src/config/config.json index afeb1151..9b77e405 100644 --- a/src/config/config.json +++ b/src/config/config.json @@ -456,7 +456,7 @@ } }, "targets": [ - "^https?:\\/{2}(?:[a-zA-Z0-9]+\\.)?fandom\\.com(?=(?:\\/wiki)|(?:\\/?$))" + "^https?:\\/{2}(?:[a-zA-Z0-9-]+\\.)?fandom\\.com(?=(?:\\/wiki)|(?:\\/?$))" ], "name": "Fandom", "options": { |