diff --git a/app/lib/utils/uri_parser.dart b/app/lib/utils/uri_parser.dart index 0fdef59a..06026127 100644 --- a/app/lib/utils/uri_parser.dart +++ b/app/lib/utils/uri_parser.dart @@ -1,3 +1,5 @@ +import 'package:universal_io/io.dart'; + final _domainRegex = RegExp(r'\.[a-zA-Z]{2,}$'); const _supportedSchemes = {'https', 'http', 'ftp', 'file', 'content', 'about'}; @@ -9,6 +11,8 @@ Uri? tryParseUrl(String? input, {bool eagerParsing = false}) { if (uri.pathSegments.isNotEmpty) { if (_domainRegex.hasMatch(uri.pathSegments.first)) { uri = Uri.tryParse('https://$input'); + } else if (InternetAddress.tryParse(uri.pathSegments.first) != null) { + uri = Uri.tryParse('https://$input'); } } }