Skip to content

Commit

Permalink
fix: check scheme when pasting a link
Browse files Browse the repository at this point in the history
  • Loading branch information
poppingmoon committed Oct 30, 2024
1 parent 040837c commit a7b6962
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/view/widget/post_form.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit a7b6962

Please sign in to comment.