From 428d40a3b124fe23f3101f09f6a5ada1abc85882 Mon Sep 17 00:00:00 2001 From: nfebe Date: Tue, 29 Apr 2025 00:29:01 +0100 Subject: [PATCH] fix(files_sharing): Create `download` attribute when toggling checkbox if missing Previously, toggling the checkbox did not create the 'download' attribute if it was missing, causing it to become unresponsive after a page reload. Now, setShareAttribute ensures the attribute is updated or created correctly. Signed-off-by: nfebe [skip ci] --- .../src/views/SharingDetailsTab.vue | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/apps/files_sharing/src/views/SharingDetailsTab.vue b/apps/files_sharing/src/views/SharingDetailsTab.vue index a2f0bfd58e5da..819b0542cdca3 100644 --- a/apps/files_sharing/src/views/SharingDetailsTab.vue +++ b/apps/files_sharing/src/views/SharingDetailsTab.vue @@ -713,6 +713,30 @@ export default { }, methods: { + /** + * Set a share attribute on the current share + * @param {string} scope The attribute scope + * @param {string} key The attribute key + * @param {boolean} value The value + */ + setShareAttribute(scope, key, value) { + if (!this.share.attributes) { + this.$set(this.share, 'attributes', []) + } + + const attribute = this.share.attributes + .find((attr) => attr.scope === scope || attr.key === key) + + if (attribute) { + attribute.value = value + } else { + this.share.attributes.push({ + scope, + key, + value, + }) + } + }, updateAtomicPermissions({ isReadChecked = this.hasRead, isEditChecked = this.canEdit,