Skip to content

fix(files_sharing): restore state when updating share failed - #54055

Merged
susnux merged 2 commits into
masterfrom
fix/sharing-restore-on-failure
Jul 23, 2025
Merged

fix(files_sharing): restore state when updating share failed#54055
susnux merged 2 commits into
masterfrom
fix/sharing-restore-on-failure

Conversation

@susnux

Copy link
Copy Markdown
Contributor

Summary

We need to save the previous state - here the password - so that if the update fails we can revert the shown state.
This happens e.g. if you have the password policy app and try to add an insecure password.

To reproduce (with password policy):

  1. Create new link share
  2. enable password protection
  3. use insecure password like 1234
  4. save share

Now you see that the update failed, but the password protection is still enabled. This happened because password and newPassword were misused. password was already set when newPassword was not saved so we could not know to what we need to reset when the update failed.

Checklist

@susnuxsusnux added this to the Nextcloud 32 milestone Jul 23, 2025
@susnux
susnux requested a review from a team as a code ownerJuly 23, 2025 11:00
@susnuxsusnux added the bug label Jul 23, 2025
@susnux
susnux removed the request for review from a teamJuly 23, 2025 11:00
@susnuxsusnux added the 3. to review Waiting for reviews label Jul 23, 2025
@susnux

Copy link
Copy Markdown
ContributorAuthor

/backport to stable31

@susnux

Copy link
Copy Markdown
ContributorAuthor

/backport to stable30

@susnux
susnux requested review from leftybournes and nfebe and removed request for artongeJuly 23, 2025 11:01
@susnux
susnuxforce-pushed the fix/sharing-restore-on-failure branch from 3dcfc18 to a0ffce8CompareJuly 23, 2025 11:56
@susnux

Copy link
Copy Markdown
ContributorAuthor

/compile

@skjnldsvskjnldsv left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code make sense, did not test though

@nextcloud-command
nextcloud-command requested a review from a team as a code ownerJuly 23, 2025 12:03
susnuxand others added 2 commits July 23, 2025 17:07
We need to save the previous state - here the password - so that if the
update fails we can revert the shown state.
This happens e.g. if you have the password policy app and try to add an
unsecure password.
To reproduce (with password policy):
1. Create new link share
2. enable password protection
3. use insecure password like `1234`
4. save share
Now you see that the update failed, but the password protection is still
enabled. This happened because `password` and `newPassword` were
misused. `password` was already set when `newPassword` was not saved so
we could not know to what we need to reset when the update failed.
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Signed-off-by: nextcloud-command <nextcloud-command@users.noreply.github.com>
@susnux
susnuxforce-pushed the fix/sharing-restore-on-failure branch from cfbdd96 to 1fbce91CompareJuly 23, 2025 15:07
@susnux
susnux merged commit 0d07542 into masterJul 23, 2025
132 of 135 checks passed
@susnux
susnux deleted the fix/sharing-restore-on-failure branch July 23, 2025 16:30
@skjnldsvskjnldsv mentioned this pull request Aug 19, 2025
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@susnux@skjnldsv@provokateurin@nextcloud-command