mirror of
https://github.com/foss42/apidash.git
synced 2025-12-02 02:39:19 +08:00
Fix: prevent malformed URL error when parsing IP:PORT by adding default scheme if missing
This commit is contained in:
@@ -32,7 +32,13 @@ String stripUrlParams(String url) {
|
||||
|
||||
if (kLocalhostRegex.hasMatch(url)) {
|
||||
url = '${SupportedUriSchemes.http.name}://$url';
|
||||
} else {
|
||||
final hasScheme = RegExp(r'^[a-zA-Z][a-zA-Z0-9+.-]*://').hasMatch(url);
|
||||
if (!hasScheme) {
|
||||
url = "${defaultUriScheme.name}://$url";
|
||||
}
|
||||
}
|
||||
|
||||
Uri? uri = Uri.tryParse(url);
|
||||
if (uri == null) {
|
||||
return (null, "Check URL (malformed)");
|
||||
|
||||
Reference in New Issue
Block a user