From 76c6dd2ddd2e95f33ce8354a2529788b9b49504f Mon Sep 17 00:00:00 2001 From: Namonay Date: Fri, 16 May 2025 00:10:07 +0200 Subject: [PATCH] Added a regex in input to avoid manipulation of the api link --- lib/views/home_screen.dart | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/views/home_screen.dart b/lib/views/home_screen.dart index 1a04d7b..79e44fb 100644 --- a/lib/views/home_screen.dart +++ b/lib/views/home_screen.dart @@ -12,7 +12,8 @@ class _HomeScreenState extends State { final TextEditingController _controller = TextEditingController(); void _handleInput(BuildContext context, String input) { - // Replace with your desired logic + final regex = RegExp(r'^[a-zA-Z\-]+$'); + if (input.isEmpty || regex.hasMatch(input) == false) { return; } ScaffoldMessenger.of(context).showSnackBar( SnackBar(content: Text('Checking profile of: $input')), );