Skip to content

Commit be74a15

Browse files
authored
Merge pull request #55983 from nextcloud/backport/55580/stable32
[stable32] fix(files_sharing): Only send password on change
2 parents e73a2b0 + 4dd4683 commit be74a15

File tree

12 files changed

+27
-14
lines changed

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
@@ -1342,10 +1342,13 @@ public function updateShare(
13421342
$share->setPermissions($permissions);
13431343
}
13441344

1345-
if ($password === '') {
1346-
$share->setPassword(null);
1347-
} elseif ($password !== null) {
1348-
$share->setPassword($password);
1345+
$passwordParamSent = $password !== null;
1346+
if ($passwordParamSent) {
1347+
if ($password === '') {
1348+
$share->setPassword(null);
1349+
} else {
1350+
$share->setPassword($password);
1351+
}
13491352
}
13501353

13511354
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
@@ -979,7 +979,11 @@ export default {
979979
},
980980
async saveShare() {
981981
const permissionsAndAttributes = ['permissions', 'attributes', 'note', 'expireDate']
982-
const publicShareAttributes = ['label', 'password', 'hideDownload']
982+
const publicShareAttributes = ['label', 'hideDownload']
983+
// Only include password if it's being actively changed
984+
if (this.hasUnsavedPassword) {
985+
publicShareAttributes.push('password')
986+
}
983987
if (this.config.allowCustomTokens) {
984988
publicShareAttributes.push('token')
985989
}
@@ -1142,7 +1146,11 @@ export default {
11421146
* "sendPasswordByTalk".
11431147
*/
11441148
onPasswordProtectedByTalkChange() {
1145-
this.queueUpdate('sendPasswordByTalk', 'password')
1149+
if (this.isEmailShareType || this.hasUnsavedPassword) {
1150+
this.queueUpdate('sendPasswordByTalk', 'password')
1151+
} else {
1152+
this.queueUpdate('sendPasswordByTalk')
1153+
}
11461154
},
11471155
isValidShareAttribute(value) {
11481156
if ([null, undefined].includes(value)) {

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

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

dist/6816-6816.js

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

dist/6816-6816.js.map

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

dist/6816-6816.js.map.license

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

0 commit comments

Comments
 (0)