From 04cfd12df514366320dd93e090ca74124d4d2ea1 Mon Sep 17 00:00:00 2001 From: poppingmoon <63451158+poppingmoon@users.noreply.github.com> Date: Thu, 31 Oct 2024 00:30:34 +0900 Subject: [PATCH] fix: check scheme when pasting a link (#462) --- lib/view/widget/post_form.dart | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/view/widget/post_form.dart b/lib/view/widget/post_form.dart index b6ceb658..e1aea57e 100644 --- a/lib/view/widget/post_form.dart +++ b/lib/view/widget/post_form.dart @@ -961,7 +961,8 @@ class PostForm extends HookConsumerWidget { final data = await Clipboard.getData(Clipboard.kTextPlain); if (data case ClipboardData(:final text?)) { - if (Uri.tryParse(text) != null) { + if (Uri.tryParse(text) case final url? + when RegExp(r'^https?$').hasMatch(url.scheme)) { if (!controller.selection.isCollapsed) { controller.insert('[', ']()'); controller.selection = TextSelection.collapsed(