Reimplement case-insensitivity move bug fix (#3047)

* Use eq for FindByPath for case sensitivity
* Handle case sensitive moves
This commit is contained in:
WithoutPants
2022-10-25 11:37:54 +11:00
committed by GitHub
parent 1c92336798
commit 479ebfc88d
4 changed files with 33 additions and 5 deletions

View File

@@ -740,7 +740,6 @@ func (s *scanJob) handleRename(ctx context.Context, f File, fp []Fingerprint) (F
for _, other := range others {
// if file does not exist, then update it to the new path
// TODO - handle #1426 scenario
fs, err := s.getFileFS(other.Base())
if err != nil {
missing = append(missing, other)
@@ -749,6 +748,14 @@ func (s *scanJob) handleRename(ctx context.Context, f File, fp []Fingerprint) (F
if _, err := fs.Lstat(other.Base().Path); err != nil {
missing = append(missing, other)
} else if strings.EqualFold(f.Base().Path, other.Base().Path) {
// #1426 - if file exists but is a case-insensitive match for the
// original filename, and the filesystem is case-insensitive
// then treat it as a move
if caseSensitive, _ := fs.IsPathCaseSensitive(other.Base().Path); !caseSensitive {
// treat as a move
missing = append(missing, other)
}
}
}