Skip to content

fix(file-provider): disconnect the domain of every account that loses its sign in - #11431

Open
jeldriks wants to merge 1 commit into
nextcloud:masterfrom
jeldriks:fix/file-provider-disconnect-after-sign-out
Open

jeldriks wants to merge 1 commit into
nextcloud:masterfrom
jeldriks:fix/file-provider-disconnect-after-sign-out

Conversation

@jeldriks

@jeldriks jeldriks commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Problem

After "Log out" of a file provider account whose domain existed when the client started, Finder keeps loading the account's folders and nothing points to the client. The domain stays connected, and the extension, which no longer has the account, refuses every request with notAuthenticated (about 1,400 in the first minute). macOS reacts to that in varying ways: most often only endless loading of files and folders, after a few minutes of waiting resulting in "You need to authenticate before accessing this item." on a file, or its own "“NextcloudDev” is signed out." banner, whose "Sign In…" fails with "The account information is not available." because "Log out" deleted the extension's stored password. These are all one problem. Seen with 35.0.3 and master (bad83ce) on macOS 27.2.

Related: #7784. This covers only Finder in file provider mode; the notice in the client itself that is asked for is not part of this PR.

Cause and change

FileProviderDomainManager::slotAccountStateChanged() disconnects the domain with "This account is not authenticated. Please check your account state in the … application." and reconnects it on sign in, but it was only connected in addDomainForAccount(), which runs when a domain is added in the running session.

This PR connects it in start() for every loaded account and, through AccountManager::accountAdded, for accounts added later. Accounts without a domain are no problem: domainForAccount() returns nil for an empty identifier. The connect in addDomainForAccount() is removed; it added another connection each time a domain was added again, so one sign out disconnected the domain several times.

The "Sign In…" button itself is unchanged. Side effect: at startup each domain gets one more reconnect when its account connects.

Tests

Three tests in testfileproviderxpcutils.cpp count the disconnects after the account loses its sign in (handleInvalidCredentials(), same branch as "Log out"): for an account that existed before start(), one added after it, and a domain added twice. They use the domain manager of a freshly created FileProvider, so a FileProvider left over from another test does not react as well. Each expects one disconnect; master gives 0, 0 and 2. Removing the loop, the accountAdded connection, or keeping the old connect each make a test fail. The tests also pass with #11383 applied on top.

Live on macOS 27.2: after "Log out", the client disconnected the domain at once, Finder showed the message above, and the extension got no further requests until signing in, when the domain was reconnected. Folders not loaded yet still show Finder's loading indicator.

Checklist

  • Sign-off message is added to all commits.
  • The commit messages are following The Conventional Commits specification.
  • The commit history is clean with no merge commits.
  • Uploaded screenshots from before and after for UI changes. (no UI change in the client)
  • Test(s) added to branch, with before/after results included in PR description, for performance improvements where applicable. (no performance claim; tests added for the fix)
  • Documentation has been updated or is not required.
  • Backports requested where applicable (critical bugfixes).
  • Labels added where applicable (bug/enhancement).
  • Milestone added for target version.

AI (if applicable)

Investigation, code and this description were drafted with Claude Code (claude-opus-5-5) and reviewed by me.

… its sign in

The domain manager only listened to an account's state changes after
adding a domain for it in the running session. A domain that already
existed when the client started was never disconnected when its account
was signed out, so Finder kept loading its folders while the extension
refused every request, with no hint at the client.

Watch the state of every account from start() on, including accounts
added later, and drop the connection in addDomainForAccount(), which
also added one more connection each time a domain was added again.

Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: Jeldrik Schröer <jeldrik@jschroeer.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant