Skip to content

Commit 3dadf60

Browse files
authored
Merge pull request #55982 from nextcloud/backport/55580/stable31
[stable31] fix(files_sharing): Only send password on change
2 parents 6779ac7 + 6413713 commit 3dadf60

12 files changed

+27
-14
lines changed

apps/files_sharing/lib/Controller/ShareAPIController.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1339,10 +1339,13 @@ public function updateShare(
13391339
$share->setPermissions($permissions);
13401340
}
13411341

1342-
if ($password === '') {
1343-
$share->setPassword(null);
1344-
} elseif ($password !== null) {
1345-
$share->setPassword($password);
1342+
$passwordParamSent = $password !== null;
1343+
if ($passwordParamSent) {
1344+
if ($password === '') {
1345+
$share->setPassword(null);
1346+
} else {
1347+
$share->setPassword($password);
1348+
}
13461349
}
13471350

13481351
if ($label !== null) {

apps/files_sharing/src/mixins/SharesMixin.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,9 @@ export default {
320320
// share api controller accepts
321321
for (const name of propertyNames) {
322322
if (name === 'password') {
323-
properties[name] = this.share.newPassword ?? this.share.password
323+
if (this.share.newPassword !== undefined) {
324+
properties[name] = this.share.newPassword
325+
}
324326
continue
325327
}
326328

apps/files_sharing/src/views/SharingDetailsTab.vue

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -976,7 +976,11 @@ export default {
976976
},
977977
async saveShare() {
978978
const permissionsAndAttributes = ['permissions', 'attributes', 'note', 'expireDate']
979-
const publicShareAttributes = ['label', 'password', 'hideDownload']
979+
const publicShareAttributes = ['label', 'hideDownload']
980+
// Only include password if it's being actively changed
981+
if (this.hasUnsavedPassword) {
982+
publicShareAttributes.push('password')
983+
}
980984
if (this.config.allowCustomTokens) {
981985
publicShareAttributes.push('token')
982986
}
@@ -1139,7 +1143,11 @@ export default {
11391143
* "sendPasswordByTalk".
11401144
*/
11411145
onPasswordProtectedByTalkChange() {
1142-
this.queueUpdate('sendPasswordByTalk', 'password')
1146+
if (this.isEmailShareType || this.hasUnsavedPassword) {
1147+
this.queueUpdate('sendPasswordByTalk', 'password')
1148+
} else {
1149+
this.queueUpdate('sendPasswordByTalk')
1150+
}
11431151
},
11441152
isValidShareAttribute(value) {
11451153
if ([null, undefined].includes(value)) {

dist/3798-3798.js

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

dist/3798-3798.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/3798-3798.js.map.license

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3798-3798.js.license

dist/4003-4003.js

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

dist/4003-4003.js.map

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

dist/4003-4003.js.map.license

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

0 commit comments

Comments
 (0)