Skip to content

Commit 99bfca2

Browse files
committed
Fix an error where shareAttributes is not parsable when selecting the current version in the version history
1 parent 337be57 commit 99bfca2

1 file changed

Lines changed: 12 additions & 7 deletions

File tree

src/views/PDFView.vue

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,19 @@ export default {
5151
if (!this.file || !this.file.shareAttributes) {
5252
return true
5353
}
54-
55-
const shareAttributes = JSON.parse(this.file.shareAttributes)
56-
const downloadPermissions = shareAttributes.find(({ scope, key }) => scope === 'permissions' && key === 'download')
57-
if (downloadPermissions) {
58-
return downloadPermissions.value
54+
try {
55+
const shareAttributes = JSON.parse(this.file.shareAttributes)
56+
const downloadPermissions = shareAttributes.find(({ scope, key }) => scope === 'permissions' && key === 'download')
57+
if (downloadPermissions) {
58+
return downloadPermissions.value
59+
}
60+
return true
61+
} catch (e) {
62+
logger.error('Error parsing shareAttributes:', e)
63+
// If shareAttributes can not be parsed, assume the file is
64+
// downloadable to avoid locking users out of their files.
65+
return true
5966
}
60-
61-
return true
6267
},
6368
6469
isRichDocumentsAvailable() {

0 commit comments

Comments
 (0)