mirror of
https://github.com/gilbertchen/duplicacy
synced 2025-12-06 00:03:38 +00:00
Validate the repository id for the init and add command
Only letter, numbers, dashes, and underscores are allowed.
This commit is contained in:
@@ -274,6 +274,13 @@ func configRepository(context *cli.Context, init bool) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
snapshotIDRegex := regexp.MustCompile(`^[A-Za-z0-9_\-]+$`)
|
||||||
|
matched := snapshotIDRegex.FindStringSubmatch(snapshotID)
|
||||||
|
if matched == nil {
|
||||||
|
duplicacy.LOG_ERROR("PREFERENCE_INVALID", "'%s' is an invalid snapshot id", snapshotID)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
var repository string
|
var repository string
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user