mirror of
https://github.com/octoleo/syncthing.git
synced 2025-01-08 17:24:08 +00:00
Merge pull request #1988 from calmh/dups
Don't rename duplicate folders (fixes #1675)
This commit is contained in:
commit
fd9bc20bc5
@ -9,7 +9,6 @@ package config
|
||||
|
||||
import (
|
||||
"encoding/xml"
|
||||
"fmt"
|
||||
"io"
|
||||
"math/rand"
|
||||
"os"
|
||||
@ -310,7 +309,6 @@ func (cfg *Configuration) prepare(myID protocol.DeviceID) {
|
||||
|
||||
// Check for missing, bad or duplicate folder ID:s
|
||||
var seenFolders = map[string]*FolderConfiguration{}
|
||||
var uniqueCounter int
|
||||
for i := range cfg.Folders {
|
||||
folder := &cfg.Folders[i]
|
||||
|
||||
@ -339,15 +337,8 @@ func (cfg *Configuration) prepare(myID protocol.DeviceID) {
|
||||
|
||||
if seen, ok := seenFolders[folder.ID]; ok {
|
||||
l.Warnf("Multiple folders with ID %q; disabling", folder.ID)
|
||||
|
||||
seen.Invalid = "duplicate folder ID"
|
||||
if seen.ID == folder.ID {
|
||||
uniqueCounter++
|
||||
seen.ID = fmt.Sprintf("%s~%d", folder.ID, uniqueCounter)
|
||||
}
|
||||
folder.Invalid = "duplicate folder ID"
|
||||
uniqueCounter++
|
||||
folder.ID = fmt.Sprintf("%s~%d", folder.ID, uniqueCounter)
|
||||
} else {
|
||||
seenFolders[folder.ID] = folder
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user