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

Aperta
#12,687 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@Eiji-Kondo ci sta già lavorando.

Dal 11/11/2026.

  • #12688 di @Eiji-Kondo — aperta

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
25/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Ferma
Stack tecnologico
cpp
Ambito
backend, desktop

Direzione di ricerca

Read the removal flows in src/gui/accountsgui/accountviewcontroller.cpp and src/gui/FoldersGui/accountfolderscontroller.cpp, then trace teardown through src/gui/accountmanager.cpp and src/gui/folder.cpp. The issue also names src/gui/folderman.cpp for duplicate path selection. Start by reviewing the existing removal dialogs and GUI tests; done means a safe, opt-in folder removal flow with clear handling of existing paths, covered by tests. An open linked pull request is already addressing this issue.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
C++
Stelle
1.5k
Fork
695
Merge medio
8g 7h
PR unite (30g)
6

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di owncloud/client

Tutte le issue di owncloud/client

Issue simili

Altre issue su C++

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.