Bugfix in automatic source selection for URL input

This commit is contained in:
Imran Remtulla
2024-01-19 00:00:47 -05:00
parent 183fb26988
commit 15a34e53bf

View File

@@ -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) {