Skip to content

fix: do not fail moves when the old location cannot be resolved#2784

Open
solracsf wants to merge 1 commit into
masterfrom
fix/filemove-unresolvable-source
Open

fix: do not fail moves when the old location cannot be resolved#2784
solracsf wants to merge 1 commit into
masterfrom
fix/filemove-unresolvable-source

Conversation

@solracsf

@solracsf solracsf commented Jul 9, 2026

Copy link
Copy Markdown
Member

Related: nextcloud/groupfolders#4548
This has been found by analyzing the stack traces in that issue.

When the pre-rename hook cannot resolve the old location of a move by file id (NotFoundException from View::getPath(), e.g. on instances with inconsistent mount or file cache state), fileMove() aborted after setting $this->moveCase but before collecting $this->oldAccessList.

The post-rename hook then crashed with "TypeError: array_keys(): Argument #1 ($array) must be of type array, null given" in fileMoving(). Since OC_Hook::emit() only catches Exceptions, the TypeError failed the whole WebDAV MOVE request after the files had already been moved, leaving clients out of sync with the server.

Collect the state in fileMove() under a NotFoundException guard that disables the post hook handling instead, and bail out of fileMoving() if the old access list was never collected.

Actually, this results in things like files being moved correctly on disk, but not on oc_filecache, and only a manual scan will fix it.

🤖 AI (if applicable)

  • The content of this PR was partly or fully generated using AI

Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
@solracsf

solracsf commented Jul 9, 2026

Copy link
Copy Markdown
Member Author

/backport to stable34

@solracsf

solracsf commented Jul 9, 2026

Copy link
Copy Markdown
Member Author

/backport to stable33

@solracsf

solracsf commented Jul 9, 2026

Copy link
Copy Markdown
Member Author

/backport to stable32

@solracsf solracsf requested review from artonge and miaulalala July 9, 2026 11:11
@solracsf solracsf self-assigned this Jul 9, 2026
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.

1 participant