code refactor for name checker

This commit is contained in:
UlricQin 2021-07-22 14:51:14 +08:00
parent 8a06cac5f1
commit 3236d7dfd1
2 changed files with 9 additions and 0 deletions

View File

@ -28,6 +28,10 @@ func (c *Classpath) Validate() error {
return _e("Classpath path has invalid characters")
}
if strings.Contains(c.Path, " ") {
return _e("Classpath path has invalid characters")
}
if str.Dangerous(c.Note) {
return _e("Classpath note has invalid characters")
}

View File

@ -33,6 +33,11 @@ func (d *Dashboard) Validate() error {
if str.Dangerous(d.Name) {
return _e("Dashboard name has invalid characters")
}
if strings.Contains(d.Name, "://") {
return _e("Dashboard name has invalid characters")
}
return nil
}