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 <jonas@freesources.org>
  • Loading branch information
mejo- committed Jun 8, 2023
1 parent 1b31539 commit 0e8d481
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 0e8d481

Please sign in to comment.