Skip to content

fix(sync): delete-revert — Windows backslash in fsnotify path yields wrong remote path #153

Description

@CCoupel

Symptôme

Suppression d'un fichier local → le fichier revient depuis le remote (delete-revert).

Root cause

handleLocalEvent construit le remote path avec :

remotePath := path.Join(e.remotePath, evt.Path)

Sur Windows, fsnotify retourne evt.Path avec des backslashes pour les fichiers dans des sous-dossiers (ex : subdir\file.txt). Le package path (Unix) traite le backslash comme un caractère de nom de fichier ordinaire → /remote/subdir\file.txt au lieu de /remote/subdir/file.txt → backend.Delete retourne 404 → remote conservé → le fichier revient au prochain scan.

Fix

internal/sync/engine.go handleLocalEvent :

remoteRelPath := filepath.ToSlash(evt.Path)
remotePath := path.Join(e.remotePath, remoteRelPath)
// Et pour ActionRename :
srcRemoteRelPath := filepath.ToSlash(evt.OldPath)
SrcRemotePath: path.Join(e.remotePath, srcRemoteRelPath)

Tests

TestEngine_HandleLocalEvent_BackslashPath_Delete, TestEngine_HandleLocalEvent_BackslashPath_Rename (Windows-only — skippés sur Linux CI)

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

    backendCode Go / moteur de synchronisationbugSomething isn't workingwindows-apiCloud Filter API, WinFsp, placeholders

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions