mirror of
https://github.com/zrepl/zrepl.git
synced 2024-11-21 16:03:32 +01:00
zfs: check for forbidden dataset path characters
This commit is contained in:
parent
301be177ea
commit
28f0b90c25
@ -45,7 +45,10 @@ func NewDatasetPath(s string) (p DatasetPath, err error) {
|
||||
if s == "" {
|
||||
return EmptyDatasetPath, nil // the empty dataset path
|
||||
}
|
||||
// TODO validation
|
||||
const FORBIDDEN = "@#|\t "
|
||||
if strings.ContainsAny(s, FORBIDDEN) { // TODO space may be a bit too restrictive...
|
||||
return nil, errors.New(fmt.Sprintf("path '%s' contains forbidden characters (any of '%s')", s, FORBIDDEN))
|
||||
}
|
||||
return toDatasetPath(s), nil
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user