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; AppSource? source;
for (var s in sources.where((element) => element.hosts.isNotEmpty)) { for (var s in sources.where((element) => element.hosts.isNotEmpty)) {
if (RegExp( try {
'://${s.allowSubDomains ? '([^\\.]+\\.)*' : '(www\\.)?'}(${getSourceRegex(s.hosts)})(/|\\z)?') if (RegExp(
.hasMatch(url)) { '^${s.allowSubDomains ? '([^\\.]+\\.)*' : '(www\\.)?'}(${getSourceRegex(s.hosts)})\$')
source = s; .hasMatch(Uri.parse(url).host)) {
break; source = s;
break;
}
} catch (e) {
// Ignore
} }
} }
if (source == null) { if (source == null) {