Handle corner case in conflict check

This commit is contained in:
Silvano Cerza 2025-02-28 17:39:06 +01:00
parent e4409cb96e
commit 7d389f8e0c

View file

@ -446,10 +446,17 @@ export default class SyncManager {
remoteFile.sha !== localFile.sha;
const localFileHasBeenModifiedSinceLastSync =
actualLocalSHA !== localFile.sha;
// This is an unlikely case. If the user manually edits
// the local file so that's identical to the remote one,
// but the local metadata SHA is different we don't want
// to show a conflict.
// Since that would show two identical files.
// Checking for this prevents showing a non conflict to the user.
const actualFilesAreDifferent = remoteFile.sha !== actualLocalSHA;
if (
remoteFileHasBeenModifiedSinceLastSync &&
localFileHasBeenModifiedSinceLastSync
localFileHasBeenModifiedSinceLastSync &&
actualFilesAreDifferent
) {
return filePath;
}