From 15a34e53bfccb16ec0a54152ae5649ec7e620bad Mon Sep 17 00:00:00 2001 From: Imran Remtulla Date: Fri, 19 Jan 2024 00:00:47 -0500 Subject: [PATCH] Bugfix in automatic source selection for URL input --- lib/providers/source_provider.dart | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/lib/providers/source_provider.dart b/lib/providers/source_provider.dart index 2c55e00..249111c 100644 --- a/lib/providers/source_provider.dart +++ b/lib/providers/source_provider.dart @@ -734,11 +734,15 @@ class SourceProvider { } AppSource? source; for (var s in sources.where((element) => element.hosts.isNotEmpty)) { - if (RegExp( - '://${s.allowSubDomains ? '([^\\.]+\\.)*' : '(www\\.)?'}(${getSourceRegex(s.hosts)})(/|\\z)?') - .hasMatch(url)) { - source = s; - break; + try { + if (RegExp( + '^${s.allowSubDomains ? '([^\\.]+\\.)*' : '(www\\.)?'}(${getSourceRegex(s.hosts)})\$') + .hasMatch(Uri.parse(url).host)) { + source = s; + break; + } + } catch (e) { + // Ignore } } if (source == null) {