From fe3926f0f05c2025e5cec0ab5c7246a8bf63fe3c Mon Sep 17 00:00:00 2001 From: Julius Härtl Date: Fri, 30 Aug 2024 15:33:03 +0200 Subject: fix: Properly handle share attributes if set to null MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- apps/files_sharing/src/views/SharingDetailsTab.vue | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'apps/files_sharing/src') diff --git a/apps/files_sharing/src/views/SharingDetailsTab.vue b/apps/files_sharing/src/views/SharingDetailsTab.vue index 3d6f5e6495f..baa098352d1 100644 --- a/apps/files_sharing/src/views/SharingDetailsTab.vue +++ b/apps/files_sharing/src/views/SharingDetailsTab.vue @@ -423,13 +423,22 @@ export default { */ canDownload: { get() { - return this.share.attributes.find(attr => attr.key === 'download')?.value || false + return this.share.attributes?.find(attr => attr.key === 'download')?.value ?? true }, set(checked) { // Find the 'download' attribute and update its value - const downloadAttr = this.share.attributes.find(attr => attr.key === 'download') + const downloadAttr = this.share.attributes?.find(attr => attr.key === 'download') if (downloadAttr) { downloadAttr.value = checked + } else { + if (this.share.attributes === null) { + this.$set(this.share, 'attributes', []) + } + this.share.attributes.push({ + scope: 'permissions', + key: 'download', + value: checked, + }) } }, }, -- cgit v1.2.3