]> source.dussan.org Git - nextcloud-server.git/commitdiff
fix(files_sharing): Create passwords when enforced for mail shares
authorFerdinand Thiessen <opensource@fthiessen.de>
Fri, 29 Mar 2024 14:30:39 +0000 (15:30 +0100)
committerFerdinand Thiessen <opensource@fthiessen.de>
Thu, 4 Apr 2024 14:20:11 +0000 (16:20 +0200)
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
apps/files_sharing/src/models/Share.js
apps/files_sharing/src/views/SharingDetailsTab.vue

index 5504c63b345dc1d41144544c14eb079be547ce12..b88d376a0ff233f9b4118efa7d5fab9f8f3100b8 100644 (file)
@@ -43,11 +43,11 @@ export default class Share {
                ocsData.hide_download = !!ocsData.hide_download
                ocsData.mail_send = !!ocsData.mail_send
 
-               if (ocsData.attributes) {
+               if (ocsData.attributes && typeof ocsData.attributes === 'string') {
                        try {
                                ocsData.attributes = JSON.parse(ocsData.attributes)
                        } catch (e) {
-                               console.warn('Could not parse share attributes returned by server: "' + ocsData.attributes + '"')
+                               console.warn('Could not parse share attributes returned by server', ocsData.attributes)
                        }
                }
                ocsData.attributes = ocsData.attributes ?? []
@@ -310,7 +310,7 @@ export default class Share {
         * @memberof Share
         */
        get label() {
-               return this._share.label
+               return this._share.label ?? ''
        }
 
        /**
index e852a0f8599517a04ecf9df37f01756915a8d203..5e7f7c1b45267cb6b5478a07284101f6bf0ff342 100644 (file)
@@ -509,7 +509,7 @@ export default {
                        return this.share.type === this.SHARE_TYPES.SHARE_TYPE_GROUP
                },
                isNewShare() {
-                       return this.share.id === null || this.share.id === undefined
+                       return !this.share.id
                },
                allowsFileDrop() {
                        if (this.isFolder && this.config.isPublicUploadEnabled) {
@@ -788,13 +788,10 @@ export default {
 
                },
                handleShareType() {
-                       if (this.share.share_type) {
-                               this.share.type = this.share.share_type
-                       }
-                       // shareType 0 (USER_SHARE) would evaluate to zero
-                       // Hence the use of hasOwnProperty
                        if ('shareType' in this.share) {
                                this.share.type = this.share.shareType
+                       } else if (this.share.share_type) {
+                               this.share.type = this.share.share_type
                        }
                },
                handleDefaultPermissions() {
@@ -815,7 +812,7 @@ export default {
                                this.sharingPermission = 'custom'
                                this.advancedSectionAccordionExpanded = true
                                this.setCustomPermissions = true
-                       } else {
+                       } else if (this.share.permissions) {
                                this.sharingPermission = this.share.permissions.toString()
                        }
                },