Skip to content

Commit 11ac9b3

Browse files
authored
Merge pull request #44591 from nextcloud/backport/44571/stable29
[stable29] fix(files_sharing): Create passwords when enforced for mail shares
2 parents 7a4e0c0 + 8a008d3 commit 11ac9b3

9 files changed

Lines changed: 14 additions & 17 deletions

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
@@ -509,7 +509,7 @@ export default {
509509
return this.share.type === this.SHARE_TYPES.SHARE_TYPE_GROUP
510510
},
511511
isNewShare() {
512-
return this.share.id === null || this.share.id === undefined
512+
return !this.share.id
513513
},
514514
allowsFileDrop() {
515515
if (this.isFolder && this.config.isPublicUploadEnabled) {
@@ -788,13 +788,10 @@ export default {
788788
789789
},
790790
handleShareType() {
791-
if (this.share.share_type) {
792-
this.share.type = this.share.share_type
793-
}
794-
// shareType 0 (USER_SHARE) would evaluate to zero
795-
// Hence the use of hasOwnProperty
796791
if ('shareType' in this.share) {
797792
this.share.type = this.share.shareType
793+
} else if (this.share.share_type) {
794+
this.share.type = this.share.share_type
798795
}
799796
},
800797
handleDefaultPermissions() {
@@ -815,7 +812,7 @@ export default {
815812
this.sharingPermission = 'custom'
816813
this.advancedSectionAccordionExpanded = true
817814
this.setCustomPermissions = true
818-
} else {
815+
} else if (this.share.permissions) {
819816
this.sharingPermission = this.share.permissions.toString()
820817
}
821818
},

dist/4997-4997.js

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/4997-4997.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/938-938.js

Lines changed: 0 additions & 3 deletions
This file was deleted.

dist/938-938.js.map

Lines changed: 0 additions & 1 deletion
This file was deleted.

dist/files_sharing-files_sharing_tab.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/files_sharing-files_sharing_tab.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)