From 89da1fd8fe4cdb2f8ad5c6df117b9873693efe39 Mon Sep 17 00:00:00 2001 From: SukkaW Date: Sat, 3 Jan 2026 16:06:25 +0800 Subject: [PATCH] Fix fake websites redirect in uBO --- Build/build-sgmodule-redirect.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Build/build-sgmodule-redirect.ts b/Build/build-sgmodule-redirect.ts index be491a6a..7ae6cec9 100644 --- a/Build/build-sgmodule-redirect.ts +++ b/Build/build-sgmodule-redirect.ts @@ -269,7 +269,15 @@ function uBOUriTransformGeneratorForFakeWebsites(acc: string[], [from, to]: [fro '||' + from + '$all,uritransform=/' - + String.raw`.*` + escapeRegexp(from).replaceAll('/', String.raw`\/`) + String.raw`\/(.*)` + // \/.*formysql\.com\/.* + // + // By adding \/.* at the beginning and the end, we can avoid replace the protocol (https:// or http://), + // which will bork uBlock Origin's filter matching (requires final URL to be a valid URL): + // + // https://www.formysql.com/en/products/navicat-for-mysql + // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + // https://www.navicat.com.cn + + String.raw`\/.*` + escapeRegexp(from).replaceAll('/', String.raw`\/`) + String.raw`.*` + '/' + to.replace('https://', '').replaceAll('/', String.raw`\/`) + '/'