Skip to content

Account removal silently keeps the local sync folder, so re-adding creates ownCloud (2), (3), … #12687

Open

Description

@Eiji-Kondo

Problem

Removing an account (or a folder sync connection) never offers to delete the
local sync folder. The client only shows a fixed note saying files are kept,
and the folder is left on disk. Because the wizard then re-uses ~/ownCloud
and appends a number whenever that path already exists, every
remove-and-re-add cycle creates a new folder:

C:\Users\<user>\ownCloud
C:\Users\<user>\ownCloud (2)
C:\Users\<user>\ownCloud (3)
...

There is no way to tell the client "also delete the local folder", and no hint
that the leftover folder is what causes the numbered duplicates. Users are
surprised by the ever-growing pile of folders.

Steps to reproduce

  1. Add an account with default settings (local folder ~/ownCloud).
  2. Remove the account ("Remove connection").
  3. Add an account again with default settings.
  4. Observe the new local folder is ~/ownCloud (2), then (3), (4)… on
    each repetition.

Why this happens

  • AccountViewController::onDeleteAccount() (src/gui/accountsgui/accountviewcontroller.cpp)
    and AccountFoldersController::onRemoveSync() (src/gui/FoldersGui/accountfolderscontroller.cpp)
    show only a Yes/No confirmation with a fixed note:
    Note: This will not delete any files. There is no "delete local files"
    option.
  • AccountManager::deleteAccount() (src/gui/accountmanager.cpp) only calls
    Utility::unmarkDirectoryAsSyncRoot(defaultSyncRoot()) (removes the NTFS
    ADS tags), and Folder::wipeForRemoval() (src/gui/folder.cpp) removes only
    the state DB (.sync_*.db) and temporaries. User files/folders are never
    touched.
  • On re-add, FolderMan::findGoodPathForNewSyncFolder() (src/gui/folderman.cpp)
    starts from ~/ownCloud and, while QFileInfo::exists(folder) is true,
    appends " (2)", " (3)", … up to " (100)". So the leftover folder
    directly causes the numbered duplicate.

A secondary, harder-to-recover variant: if the hidden .sync_*.db is left
behind (e.g. the connection was removed while a sync was running), the folder
is later rejected as "used in a folder sync connection"
(FolderManagementUtils::numberOfSyncJournals() and
FolderMan::checkPathForSyncRootMarkingRecursive()), so the user cannot even
re-select it manually.

Proposed solution

Add an opt-in "also delete the local folder" choice to the two removal
confirmations, defaulting to the current safe behaviour (keep files):

  1. In the confirmation dialogs, add a checkbox such as
    Delete the local folder "<path>" (unchecked by default), shown only when
    the folder exists and is empty of non-synced data, or always shown with a
    clear warning.
  2. On removal, if the user checked it, delete the local folder after the
    account/folder teardown, preferring the OS trash over a permanent delete
    (QFile::moveToTrash on Qt 5.15+, or FileSystem::removeRecursively),
    so the action stays recoverable.
  3. Independently of the checkbox, consider reusing an existing, unmarked
    ~/ownCloud folder instead of always appending a number, or at least
    telling the user why (2) was chosen.

Alternative solutions considered

  • Only improve the wording (e.g. "the folder ~/ownCloud is kept; remove it
    yourself to reuse the name"). Minimal, but still leaves users with
    accumulating folders.
  • Only auto-reuse the existing folder without an option to delete. Avoids the
    duplicate names but removes the safety net entirely.
  • Document the behaviour only. Does not fix the confusing UX.

Additional context

  • Reproduced on the current Windows client.
  • Relevant code: src/gui/accountsgui/accountviewcontroller.cpp,
    src/gui/FoldersGui/accountfolderscontroller.cpp,
    src/gui/accountmanager.cpp, src/gui/folder.cpp, src/gui/folderman.cpp.
  • The existing GUI tests (test/gui/tst_removeAccountConnection) assert only
    that the account disappears from the UI, not the dialog text, so adding a
    checkbox there should not break them.

This issue was created by an AI agent (OpenHands) on behalf of a user.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions