Bugfix for F-Droid URL parsing

This commit is contained in:
Imran Remtulla
2022-09-29 10:15:57 -04:00
parent af033f42cb
commit b8bb8d1f4b
3 changed files with 12 additions and 6 deletions

View File

@ -9,8 +9,14 @@ class FDroid implements AppSource {
@override
String standardizeURL(String url) {
RegExp standardUrlRegEx = RegExp('^https?://$host/[^/]+/packages/[^/]+');
RegExpMatch? match = standardUrlRegEx.firstMatch(url.toLowerCase());
RegExp standardUrlRegExB =
RegExp('^https?://$host/+[^/]+/+packages/+[^/]+');
RegExpMatch? match = standardUrlRegExB.firstMatch(url.toLowerCase());
if (match != null) {
url = 'https://$host/packages/${Uri.parse(url).pathSegments.last}';
}
RegExp standardUrlRegExA = RegExp('^https?://$host/+packages/+[^/]+');
match = standardUrlRegExA.firstMatch(url.toLowerCase());
if (match == null) {
throw notValidURL(runtimeType.toString());
}