Sanitize rescan interval values (fixes #1978)
This commit is contained in:
@@ -28,6 +28,7 @@ import (
|
||||
const (
|
||||
OldestHandledVersion = 5
|
||||
CurrentVersion = 10
|
||||
MaxRescanIntervalS = 365 * 24 * 60 * 60
|
||||
)
|
||||
|
||||
type Configuration struct {
|
||||
@@ -330,6 +331,12 @@ func (cfg *Configuration) prepare(myID protocol.DeviceID) {
|
||||
folder.ID = "default"
|
||||
}
|
||||
|
||||
if folder.RescanIntervalS > MaxRescanIntervalS {
|
||||
folder.RescanIntervalS = MaxRescanIntervalS
|
||||
} else if folder.RescanIntervalS < 0 {
|
||||
folder.RescanIntervalS = 0
|
||||
}
|
||||
|
||||
if seen, ok := seenFolders[folder.ID]; ok {
|
||||
l.Warnf("Multiple folders with ID %q; disabling", folder.ID)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user