From 8b610f69185deb6a8c8d1e332088af06909f37c0 Mon Sep 17 00:00:00 2001 From: Jonas Date: Wed, 7 Jun 2023 16:53:57 +0200 Subject: [PATCH] Don't expect HTML element with ID `mimetype` in public share If the share is password-protected, the authentication page doesn't have the property set yet. Fixes: #3816 Signed-off-by: Jonas --- src/public.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/public.js b/src/public.js index d8a688d9436..bcecac862d4 100644 --- a/src/public.js +++ b/src/public.js @@ -49,7 +49,6 @@ const loadEditor = ({ sharingToken, mimetype, fileId, $el }) => { } documentReady(() => { - const mimetype = document.getElementById('mimetype').value const sharingToken = document.getElementById('sharingToken') ? document.getElementById('sharingToken').value : null if (!sharingToken) { @@ -67,7 +66,8 @@ documentReady(() => { } // single file share - if (openMimetypes.indexOf(mimetype) !== -1) { + const mimetype = document.getElementById('mimetype')?.value + if (mimetype && openMimetypes.indexOf(mimetype) !== -1) { const $el = document.getElementById('preview') const fileId = loadState('text', 'file_id') loadEditor({ mimetype, sharingToken, fileId, $el })