Extract URL from instance field

This commit is contained in:
Craftplacer 2022-09-07 12:02:00 +02:00
parent 2528434dee
commit cf94ec5506
No known key found for this signature in database
GPG Key ID: 0D94BDA3F64B90CE
1 changed files with 9 additions and 1 deletions

View File

@ -166,7 +166,15 @@ class _InstancePageState extends State<InstancePage> {
void _submit() {
if (_formKey.currentState!.validate()) {
widget.onNext.call(_instanceController.text);
var host = _instanceController.text;
// Extract host from URL, if necessary
final uri = Uri.tryParse(host);
if (uri != null && uri.host.isNotEmpty) {
host = uri.host;
}
widget.onNext.call(host);
}
}