Skip to content

Bring projects, wikis, and teams together with AI. AppFlowy is the AI collaborative workspace where you achieve more without losing control of your data. The leading open source Notion alternative.

fix: could not open link without scheme

Lucas.Xu1cd9a77e0075
diff --git a/frontend/app_flowy/packages/appflowy_editor/lib/src/render/rich_text/rich_text_style.dart b/frontend/app_flowy/packages/appflowy_editor/lib/src/render/rich_text/rich_text_style.dart
index 7bd68c45e7..6bc50c5115 100644
--- a/frontend/app_flowy/packages/appflowy_editor/lib/src/render/rich_text/rich_text_style.dart
+++ b/frontend/app_flowy/packages/appflowy_editor/lib/src/render/rich_text/rich_text_style.dart
@@ -277,7 +277,13 @@ class RichTextStyle {
if (href != null) {
return TapGestureRecognizer()
..onTap = () async {
- await launchUrlString(href);
+ final uri = Uri.parse(href);
+ // url_launcher cannot open a link without scheme.
+ final newHref =
+ (uri.scheme.isNotEmpty ? href : 'http://$href').trim();
+ if (await canLaunchUrlString(newHref)) {
+ await launchUrlString(newHref);
+ }
};
}
return null;