diff --git a/apps/files_sharing/lib/Controller/ShareAPIController.php b/apps/files_sharing/lib/Controller/ShareAPIController.php index 8ba50d54d3fce..ee0c2e1ac5d40 100644 --- a/apps/files_sharing/lib/Controller/ShareAPIController.php +++ b/apps/files_sharing/lib/Controller/ShareAPIController.php @@ -1342,10 +1342,13 @@ public function updateShare( $share->setPermissions($permissions); } - if ($password === '') { - $share->setPassword(null); - } elseif ($password !== null) { - $share->setPassword($password); + $passwordParamSent = $this->request->getParam('password') !== null; + if ($passwordParamSent) { + if ($password === '') { + $share->setPassword(null); + } else { + $share->setPassword($password); + } } if ($label !== null) { diff --git a/apps/files_sharing/src/mixins/SharesMixin.js b/apps/files_sharing/src/mixins/SharesMixin.js index 4599085e6dd31..1a6e235e61bb4 100644 --- a/apps/files_sharing/src/mixins/SharesMixin.js +++ b/apps/files_sharing/src/mixins/SharesMixin.js @@ -316,7 +316,9 @@ export default { // share api controller accepts for (const name of propertyNames) { if (name === 'password') { - properties[name] = this.share.newPassword ?? this.share.password + if (this.share.newPassword !== undefined) { + properties[name] = this.share.newPassword + } continue } diff --git a/apps/files_sharing/src/views/SharingDetailsTab.vue b/apps/files_sharing/src/views/SharingDetailsTab.vue index cee536fb2edfd..22f569d2cf921 100644 --- a/apps/files_sharing/src/views/SharingDetailsTab.vue +++ b/apps/files_sharing/src/views/SharingDetailsTab.vue @@ -1054,7 +1054,11 @@ export default { async saveShare() { const permissionsAndAttributes = ['permissions', 'attributes', 'note', 'expireDate'] - const publicShareAttributes = ['label', 'password', 'hideDownload'] + const publicShareAttributes = ['label', 'hideDownload'] + // Only include password if it's being actively changed + if (this.hasUnsavedPassword) { + publicShareAttributes.push('password') + } if (this.config.allowCustomTokens) { publicShareAttributes.push('token') } @@ -1220,7 +1224,11 @@ export default { * "sendPasswordByTalk". */ onPasswordProtectedByTalkChange() { - this.queueUpdate('sendPasswordByTalk', 'password') + if (this.isEmailShareType || this.hasUnsavedPassword) { + this.queueUpdate('sendPasswordByTalk', 'password') + } else { + this.queueUpdate('sendPasswordByTalk') + } }, isValidShareAttribute(value) {