Skip to content

Commit

Permalink
Don't expect HTML element with ID mimetype in public share
Browse files Browse the repository at this point in the history
If the share is password-protected, the authentication page doesn't have
the property set yet.

Fixes: #3816

Signed-off-by: Jonas <[email protected]>
  • Loading branch information
mejo- authored and backportbot-nextcloud[bot] committed Jun 7, 2023
1 parent b1e421f commit 62ddc4c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/public.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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 })
Expand Down

0 comments on commit 62ddc4c

Please sign in to comment.