Browse Source

fix(share): Send correct share attributes upon share creation

- Send correct share attributes (`share.attributes`) to server upon creation.
- Delete parts of code that create or reference, `share.hasDownloadPermission`
(Not required by Share API)

Resolves : https://github.com/nextcloud/server/issues/44131

Signed-off-by: fenn-cs <fenn25.fn@gmail.com>
fenn-cs 1 month ago
parent
commit
3a5475bd64
1 changed files with 8 additions and 8 deletions
  1. 8 8
      apps/files_sharing/src/views/SharingDetailsTab.vue

+ 8 - 8
apps/files_sharing/src/views/SharingDetailsTab.vue

@@ -404,10 +404,14 @@ export default {
 		 */
 		canDownload: {
 			get() {
-				return this.share.hasDownloadPermission
+				return this.share.attributes.find(attr => attr.key === 'download')?.enabled || false
 			},
 			set(checked) {
-				this.updateAtomicPermissions({ isDownloadChecked: checked })
+				// Find the 'download' attribute and update its value
+				const downloadAttr = this.share.attributes.find(attr => attr.key === 'download')
+				if (downloadAttr) {
+					downloadAttr.enabled = checked
+				}
 			},
 		},
 		/**
@@ -723,7 +727,6 @@ export default {
 			isCreateChecked = this.canCreate,
 			isDeleteChecked = this.canDelete,
 			isReshareChecked = this.canReshare,
-			isDownloadChecked = this.canDownload,
 		} = {}) {
 			// calc permissions if checked
 			const permissions = 0
@@ -733,9 +736,6 @@ export default {
 				| (isEditChecked ? ATOMIC_PERMISSIONS.UPDATE : 0)
 				| (isReshareChecked ? ATOMIC_PERMISSIONS.SHARE : 0)
 			this.share.permissions = permissions
-			if (this.share.hasDownloadPermission !== isDownloadChecked) {
-				this.$set(this.share, 'hasDownloadPermission', isDownloadChecked)
-			}
 		},
 		expandCustomPermissions() {
 			if (!this.advancedSectionAccordionExpanded) {
@@ -909,8 +909,8 @@ export default {
 					shareType: share.shareType,
 					shareWith: share.shareWith,
 					permissions: share.permissions,
-					attributes: JSON.stringify(fileInfo.shareAttributes),
 					expireDate: share.expireDate,
+					attributes: JSON.stringify(share.attributes),
 					...(share.note ? { note: share.note } : {}),
 					...(share.password ? { password: share.password } : {}),
 				})
@@ -1054,7 +1054,7 @@ export default {
 						flex-direction: column;
 					}
 				}
-				
+
 				/* Target component based style in NcCheckboxRadioSwitch slot content*/
 				:deep(span.checkbox-content__text.checkbox-radio-switch__text) {
 					flex-wrap: wrap;