This commit is contained in:
@@ -118,22 +118,22 @@ impl VMInfo {
|
||||
XMLUuid::new_random()
|
||||
};
|
||||
|
||||
if let Some(n) = &self.genid {
|
||||
if !n.is_valid() {
|
||||
return Err(StructureExtraction("VM genid is invalid!").into());
|
||||
}
|
||||
if let Some(n) = &self.genid
|
||||
&& !n.is_valid()
|
||||
{
|
||||
return Err(StructureExtraction("VM genid is invalid!").into());
|
||||
}
|
||||
|
||||
if let Some(n) = &self.title {
|
||||
if n.contains('\n') {
|
||||
return Err(StructureExtraction("VM title contain newline char!").into());
|
||||
}
|
||||
if let Some(n) = &self.title
|
||||
&& n.contains('\n')
|
||||
{
|
||||
return Err(StructureExtraction("VM title contain newline char!").into());
|
||||
}
|
||||
|
||||
if let Some(group) = &self.group {
|
||||
if !regex!("^[a-zA-Z0-9]+$").is_match(&group.0) {
|
||||
return Err(StructureExtraction("VM group name is invalid!").into());
|
||||
}
|
||||
if let Some(group) = &self.group
|
||||
&& !regex!("^[a-zA-Z0-9]+$").is_match(&group.0)
|
||||
{
|
||||
return Err(StructureExtraction("VM group name is invalid!").into());
|
||||
}
|
||||
|
||||
if self.memory < constants::MIN_VM_MEMORY || self.memory > constants::MAX_VM_MEMORY {
|
||||
|
Reference in New Issue
Block a user