Symptôme
Suppression ou renommage d'un fichier côté remote → le fichier local n'est pas supprimé/renommé.
Root cause
handleRemoteEvent :
localPath := filepath.Join(e.localDir, evt.Path)
Les backends Watch() peuvent retourner des chemins avec un slash initial (ex : /file.txt). Sur Windows :
filepath.Join("C:\\GhostDrive\\Backend", "/file.txt") = C:\file.txt (le second composant absolu écrase le premier → chemin hors sync root). os.Remove("C:\file.txt") échoue silencieusement (fichier introuvable à cet endroit) → fichier local non supprimé.
Fix
internal/sync/engine.go handleRemoteEvent :
relPath := strings.TrimLeft(filepath.FromSlash(evt.Path), "/\\\\")
localPath := filepath.Join(e.localDir, relPath)
// Idem pour evt.OldPath dans FileEventRenamed
oldRelPath := strings.TrimLeft(filepath.FromSlash(evt.OldPath), "/\\\\")
Ajout de logger.Error/Info pour tracer les outcomes de os.Remove/os.Rename.
Tests
TestEngine_HandleRemoteEvent_LeadingSlash_Delete, TestEngine_HandleRemoteEvent_LeadingSlash_Rename
Symptôme
Suppression ou renommage d'un fichier côté remote → le fichier local n'est pas supprimé/renommé.
Root cause
handleRemoteEvent:Les backends Watch() peuvent retourner des chemins avec un slash initial (ex :
/file.txt). Sur Windows :filepath.Join("C:\\GhostDrive\\Backend", "/file.txt")=C:\file.txt(le second composant absolu écrase le premier → chemin hors sync root).os.Remove("C:\file.txt")échoue silencieusement (fichier introuvable à cet endroit) → fichier local non supprimé.Fix
internal/sync/engine.go handleRemoteEvent:Ajout de
logger.Error/Infopour tracer les outcomes deos.Remove/os.Rename.Tests
TestEngine_HandleRemoteEvent_LeadingSlash_Delete,TestEngine_HandleRemoteEvent_LeadingSlash_Rename