Skip to content

Commit 5612d42

Browse files
susnuxbackportbot[bot]
authored andcommitted
fix(files_sharing): Create passwords when enforced for mail shares
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
1 parent a40838b commit 5612d42

2 files changed

Lines changed: 7 additions & 10 deletions

File tree

apps/files_sharing/src/models/Share.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ export default class Share {
4343
ocsData.hide_download = !!ocsData.hide_download
4444
ocsData.mail_send = !!ocsData.mail_send
4545

46-
if (ocsData.attributes) {
46+
if (ocsData.attributes && typeof ocsData.attributes === 'string') {
4747
try {
4848
ocsData.attributes = JSON.parse(ocsData.attributes)
4949
} catch (e) {
50-
console.warn('Could not parse share attributes returned by server: "' + ocsData.attributes + '"')
50+
console.warn('Could not parse share attributes returned by server', ocsData.attributes)
5151
}
5252
}
5353
ocsData.attributes = ocsData.attributes ?? []
@@ -310,7 +310,7 @@ export default class Share {
310310
* @memberof Share
311311
*/
312312
get label() {
313-
return this._share.label
313+
return this._share.label ?? ''
314314
}
315315

316316
/**

apps/files_sharing/src/views/SharingDetailsTab.vue

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,7 @@ export default {
508508
return this.share.type === this.SHARE_TYPES.SHARE_TYPE_GROUP
509509
},
510510
isNewShare() {
511-
return this.share.id === null || this.share.id === undefined
511+
return !this.share.id
512512
},
513513
allowsFileDrop() {
514514
if (this.isFolder && this.config.isPublicUploadEnabled) {
@@ -787,13 +787,10 @@ export default {
787787
788788
},
789789
handleShareType() {
790-
if (this.share.share_type) {
791-
this.share.type = this.share.share_type
792-
}
793-
// shareType 0 (USER_SHARE) would evaluate to zero
794-
// Hence the use of hasOwnProperty
795790
if ('shareType' in this.share) {
796791
this.share.type = this.share.shareType
792+
} else if (this.share.share_type) {
793+
this.share.type = this.share.share_type
797794
}
798795
},
799796
handleDefaultPermissions() {
@@ -814,7 +811,7 @@ export default {
814811
this.sharingPermission = 'custom'
815812
this.advancedSectionAccordionExpanded = true
816813
this.setCustomPermissions = true
817-
} else {
814+
} else if (this.share.permissions) {
818815
this.sharingPermission = this.share.permissions.toString()
819816
}
820817
},

0 commit comments

Comments
 (0)