mirror of
https://github.com/rclone/rclone.git
synced 2024-11-24 01:47:23 +08:00
Warn the user about files with same name but different case
Relates to #107 & #119.
This commit is contained in:
parent
74a71f7824
commit
8c211fc8df
|
@ -7,9 +7,12 @@ import (
|
||||||
"io"
|
"io"
|
||||||
"mime"
|
"mime"
|
||||||
"path"
|
"path"
|
||||||
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"golang.org/x/text/unicode/norm"
|
||||||
)
|
)
|
||||||
|
|
||||||
// CalculateModifyWindow works out modify window for Fses passed in -
|
// CalculateModifyWindow works out modify window for Fses passed in -
|
||||||
|
@ -407,19 +410,24 @@ func DeleteFiles(toBeDeleted ObjectsChan) {
|
||||||
// otherwise only files passing the filter will be added.
|
// otherwise only files passing the filter will be added.
|
||||||
func readFilesMap(fs Fs, includeAll bool) map[string]Object {
|
func readFilesMap(fs Fs, includeAll bool) map[string]Object {
|
||||||
files := make(map[string]Object)
|
files := make(map[string]Object)
|
||||||
|
normalised := make(map[string]struct{})
|
||||||
for o := range fs.List() {
|
for o := range fs.List() {
|
||||||
remote := o.Remote()
|
remote := o.Remote()
|
||||||
|
normalisedRemote := strings.ToLower(norm.NFC.String(remote))
|
||||||
if _, ok := files[remote]; !ok {
|
if _, ok := files[remote]; !ok {
|
||||||
// Make sure we don't delete excluded files if not required
|
// Make sure we don't delete excluded files if not required
|
||||||
if includeAll || Config.Filter.IncludeObject(o) {
|
if includeAll || Config.Filter.IncludeObject(o) {
|
||||||
files[remote] = o
|
files[remote] = o
|
||||||
|
if _, ok := normalised[normalisedRemote]; ok {
|
||||||
|
Log(o, "Warning: File found with same name but different case on %v", o.Fs())
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
Debug(o, "Excluded from sync (and deletion)")
|
Debug(o, "Excluded from sync (and deletion)")
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
Log(o, "Duplicate file detected")
|
Log(o, "Duplicate file detected")
|
||||||
}
|
}
|
||||||
|
normalised[normalisedRemote] = struct{}{}
|
||||||
}
|
}
|
||||||
return files
|
return files
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user