Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

web: fix image picker dialog shown for non-image attachments

Abdullah Atta9a37f7c50616
diff --git a/apps/web/src/components/editor/picker.ts b/apps/web/src/components/editor/picker.ts
index ada538d60..5da44f7aa 100644
--- a/apps/web/src/components/editor/picker.ts
+++ b/apps/web/src/components/editor/picker.ts
@@ -51,10 +51,13 @@ export async function attachFiles(files: File[]) {
return;
}
- const images =
- (await ImagePickerDialog.show({
- images: files.filter((f) => f.type.startsWith("image/"))
- })) || [];
+ let images = files.filter((f) => f.type.startsWith("image/"));
+ images =
+ images.length > 0
+ ? (await ImagePickerDialog.show({
+ images
+ })) || []
+ : [];
const documents = files.filter((f) => !f.type.startsWith("image/"));
const attachments: Attachment[] = [];
for (const file of [...images, ...documents]) {