Skip to content

Commit 62ddc4c

Browse files
mejo-backportbot-nextcloud[bot]
authored andcommitted
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 <[email protected]>
1 parent b1e421f commit 62ddc4c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/public.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ const loadEditor = ({ sharingToken, mimetype, fileId, $el }) => {
4949
}
5050

5151
documentReady(() => {
52-
const mimetype = document.getElementById('mimetype').value
5352
const sharingToken = document.getElementById('sharingToken') ? document.getElementById('sharingToken').value : null
5453

5554
if (!sharingToken) {
@@ -67,7 +66,8 @@ documentReady(() => {
6766
}
6867

6968
// single file share
70-
if (openMimetypes.indexOf(mimetype) !== -1) {
69+
const mimetype = document.getElementById('mimetype')?.value
70+
if (mimetype && openMimetypes.indexOf(mimetype) !== -1) {
7171
const $el = document.getElementById('preview')
7272
const fileId = loadState('text', 'file_id')
7373
loadEditor({ mimetype, sharingToken, fileId, $el })

0 commit comments

Comments
 (0)