X Tutup
Skip to content

Do not try to remove the same file twice#39070

Merged
jvillafanez merged 2 commits intomasterfrom
prevent_double_remove
Aug 10, 2021
Merged

Do not try to remove the same file twice#39070
jvillafanez merged 2 commits intomasterfrom
prevent_double_remove

Conversation

@jvillafanez
Copy link
Member

Description

Do not try to remove the file twice while moving it to the trashbin

Related Issue

#38923

Motivation and Context

While removing a file and moving it to the trashbin, the source file or folder was deleted twice. The second call was failing because the file was already removed in the first call. This problem was ignored in the storage (which would try to remove the file again without logging the failure) and in the trashbin (ignoring the related failure).

Since the move2trash function already takes care of removing the source (for whatever reason) in case the move fails, we only need to take care of the deletion in case the trashbin isn't setup properly. In order to distinguish this case, the move2trash function will return null instead of the true. Trashbin storage is adjusted for this case.

The overall behaviour remains compatible with the previous assumptions.

How Has This Been Tested?

Manually tested following steps described in #38923

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Database schema changes (next release will require increase of minor version instead of patch)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Technical debt
  • Tests only (no source changes)

Checklist:

  • Code changes
  • Unit tests added
  • Acceptance tests added
  • Documentation ticket raised:
  • Changelog item, see TEMPLATE

@ownclouders
Copy link
Contributor

💥 Acceptance tests pipeline apiSharePublicLink2-mariadb10.2-php7.4 failed. The build has been cancelled.

https://drone.owncloud.com/owncloud/core/31611/77/1

@ownclouders
Copy link
Contributor

💥 Acceptance tests pipeline webUIComments-chrome-mariadb10.2-php7.4 failed. The build has been cancelled.

https://drone.owncloud.com/owncloud/core/31617/130/1

@jvillafanez jvillafanez force-pushed the prevent_double_remove branch from 8b132bd to a7008dc Compare July 29, 2021 10:52
@jvillafanez jvillafanez force-pushed the prevent_double_remove branch from a7008dc to 6b5c258 Compare August 4, 2021 14:36
@sonarqubecloud
Copy link

sonarqubecloud bot commented Aug 4, 2021

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

50.0% 50.0% Coverage
0.0% 0.0% Duplication

@mmattel
Copy link
Contributor

mmattel commented Aug 10, 2021

@phil-davis fyi
Ready to merge?

@owncloud owncloud deleted a comment from update-docs bot Aug 10, 2021
@phil-davis
Copy link
Contributor

When CI is green, I am happy.
@jvillafanez are you going to merge this? Or who does?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

X Tutup