Skip to content

Commit

Permalink
Merge pull request #47638 from nextcloud/fix/share-attributes-null
Browse files Browse the repository at this point in the history
fix: Properly handle share attributes if set to null
  • Loading branch information
juliushaertl authored Aug 30, 2024
2 parents 7b05c34 + d5ab2c5 commit 7362ede
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 9 deletions.
13 changes: 11 additions & 2 deletions apps/files_sharing/src/views/SharingDetailsTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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,
})
}
},
},
Expand Down
1 change: 0 additions & 1 deletion dist/5643-5643.js.map

This file was deleted.

1 change: 0 additions & 1 deletion dist/5643-5643.js.map.license

This file was deleted.

4 changes: 2 additions & 2 deletions dist/5643-5643.js → dist/8215-8215.js

Large diffs are not rendered by default.

File renamed without changes.
1 change: 1 addition & 0 deletions dist/8215-8215.js.map

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dist/8215-8215.js.map.license
4 changes: 2 additions & 2 deletions dist/files_sharing-files_sharing_tab.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/files_sharing-files_sharing_tab.js.map

Large diffs are not rendered by default.

0 comments on commit 7362ede

Please sign in to comment.