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: ignore case sensitive of image name when dragging image to document (#6017)

Lucas.Xu70e96c01b35c
diff --git a/frontend/appflowy_flutter/lib/plugins/document/document_page.dart b/frontend/appflowy_flutter/lib/plugins/document/document_page.dart
index 362ae352d6..d835a7c00b 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/document_page.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/document_page.dart
@@ -197,13 +197,15 @@ class _DocumentPageState extends State<DocumentPage>
final isLocalMode = context.read<DocumentBloc>().isLocalMode;
final List<XFile> imageFiles = [];
- final List<XFile> otherfiles = [];
+ final List<XFile> otherFiles = [];
+
for (final file in details.files) {
+ final fileName = file.name.toLowerCase();
if (file.mimeType?.startsWith('image/') ??
- false || imgExtensionRegex.hasMatch(file.name)) {
+ false || imgExtensionRegex.hasMatch(fileName)) {
imageFiles.add(file);
} else {
- otherfiles.add(file);
+ otherFiles.add(file);
}
}
@@ -215,7 +217,7 @@ class _DocumentPageState extends State<DocumentPage>
);
await editorState!.dropFiles(
data.dropTarget!,
- otherfiles,
+ otherFiles,
widget.view.id,
isLocalMode,
);
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/copy_and_paste/paste_from_image.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/copy_and_paste/paste_from_image.dart
index 4ce4f6c405..57ebe69fc6 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/copy_and_paste/paste_from_image.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/copy_and_paste/paste_from_image.dart
@@ -35,7 +35,7 @@ extension PasteFromImage on EditorState {
final imageFiles = files.where(
(file) =>
file.mimeType?.startsWith('image/') ??
- false || imgExtensionRegex.hasMatch(file.name),
+ false || imgExtensionRegex.hasMatch(file.name.toLowerCase()),
);
for (final file in imageFiles) {