From 8d921cfbf11217bc9f66893e8b018ccbd709045c Mon Sep 17 00:00:00 2001 From: Imran Remtulla Date: Tue, 6 Aug 2024 11:45:01 -0400 Subject: [PATCH] Fix bugs in APKPure URL matching --- lib/app_sources/apkpure.dart | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/app_sources/apkpure.dart b/lib/app_sources/apkpure.dart index b3fe901..4e8a69e 100644 --- a/lib/app_sources/apkpure.dart +++ b/lib/app_sources/apkpure.dart @@ -31,14 +31,15 @@ class APKPure extends AppSource { @override String sourceSpecificStandardizeURL(String url) { RegExp standardUrlRegExB = RegExp( - '^https?://m.${getSourceRegex(hosts)}/+[^/]+/+[^/]+(/+[^/]+)?', + '^https?://m.${getSourceRegex(hosts)}(/+[^/]{2})?/+[^/]+/+[^/]+', caseSensitive: false); RegExpMatch? match = standardUrlRegExB.firstMatch(url); if (match != null) { - url = 'https://${getSourceRegex(hosts)}${Uri.parse(url).path}'; + var uri = Uri.parse(url); + url = 'https://${uri.host.substring(2)}${uri.path}'; } RegExp standardUrlRegExA = RegExp( - '^https?://(www\\.)?${getSourceRegex(hosts)}/+[^/]+/+[^/]+(/+[^/]+)?', + '^https?://(www\\.)?${getSourceRegex(hosts)}(/+[^/]{2})?/+[^/]+/+[^/]+', caseSensitive: false); match = standardUrlRegExA.firstMatch(url); if (match == null) {