fix(files_external): propagate child copy failures in AmazonS3::copy() - #63123
Open
rnixx wants to merge 1 commit into
Open
fix(files_external): propagate child copy failures in AmazonS3::copy()#63123rnixx wants to merge 1 commit into
rnixx wants to merge 1 commit into
Conversation
rnixx
requested review from
Altahrim,
leftybournes,
provokateurin and
sorbaugh
and removed request for
a team
August 10, 2026 13:58
CarlSchwan
reviewed
Aug 10, 2026
CarlSchwan
reviewed
Aug 10, 2026
When copying a directory, copy() discarded the return values of its recursive calls and always returned true. rename() relies on that value, so a failed copy still led to rmdir() on the source: every file in the directory was deleted, the destination stayed empty, and the UI reported success. This is reachable whenever a provider rejects CopyObject for objects it otherwise serves — Hetzner Object Storage answers 501 NotImplemented for SSE-C encrypted objects, which makes every single child copy fail. Signed-off-by: Robert Niederreiter <rnix@squarewave.at>
rnixx
force-pushed
the
rnixx-fix-s3-dir-copy-error-propagation
branch
from
August 11, 2026 04:49
23c1a82 to
964d9a5
Compare
Author
|
Thanks for the review — comments shortened as suggested. For the test setup I could only apply
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When copying a directory, copy() discarded the return values of its recursive calls and always returned true. rename() relies on that value, so a failed copy still led to rmdir() on the source: every file in the directory was deleted, the destination stayed empty, and the UI reported success.
This is reachable whenever a provider rejects CopyObject for objects it otherwise serves — Hetzner Object Storage answers 501 NotImplemented for SSE-C encrypted objects, which makes every single child copy fail.
Behaviour with the fix (measured on 34.0.1, Hetzner Object Storage + SSE-C)
Renaming a folder now fails visibly instead of destroying its contents:
500, the files stay where they are. Thedestination directory created by
mkdir()before the failure remains as anempty folder and can be deleted normally.
MOVEfails with500, and the client rolls thelocal rename back and re-fetches the files. It does not fall back to
upload+delete, so nothing is duplicated and nothing is lost.
Renaming remains impossible on such providers — that part is outside
Nextcloud's control. What changes is that the failure is now visible instead
of silently deleting the data.
Related
Previously reported without an issue:
https://help.nextcloud.com/t/nc-copy-move-not-working-and-destroying-files-in-s3-external-storage-with-sse-c-key/231896
(NC 31.0.8, same provider, same 501 NotImplemented, same silent data loss)
Checklist
3. to review, feature component)stable32)AI (if applicable)