From b14cd63b36e0024a6b36df2c21781ee90e0be894 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Szymon=20K=C5=82os?= Date: Thu, 15 Aug 2024 09:31:27 +0200 Subject: [PATCH] Fixes #3902 : allow double click in image picker MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Steps to reproduce the behavior: 1. Open any document in Nextcloud Office 2. Insert -> Insert Image... (it shows NC file picker) 3. Double click on any entry (or even anywhere in the dialog?) 4. Click button 'Insert Image' Result: no image inserted, in the browser console we can see error: Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'path') Signed-off-by: Szymon Kłos --- src/view/FilesAppIntegration.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/view/FilesAppIntegration.js b/src/view/FilesAppIntegration.js index 36220300b6..10ec5f37c7 100644 --- a/src/view/FilesAppIntegration.js +++ b/src/view/FilesAppIntegration.js @@ -169,7 +169,9 @@ export default { .addButton({ label: t('richdocuments', 'Insert image'), callback: (files) => { - insertFileFromPath(files[0].path) + if (files && files.length) { + insertFileFromPath(files[0].path) + } }, }) .build()