1
0
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:
Gilbert Chen
2020-11-04 21:32:07 -05:00
parent bec3a0edcd
commit 5eed6c65f6

View File

@@ -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 err error