event rules: allow to set min/max file size using "human" notation

10MB or 1GB instead of the size in bytes

Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
Nicola Murino
2022-10-16 15:28:47 +02:00
parent 5a199acbb2
commit 15b4194e8f
5 changed files with 31 additions and 18 deletions

View File

@@ -1077,8 +1077,8 @@ func (f *ConditionOptions) validate() error {
}
if f.MinFileSize > 0 && f.MaxFileSize > 0 {
if f.MaxFileSize <= f.MinFileSize {
return util.NewValidationError(fmt.Sprintf("invalid max file size %d, it is lesser or equal than min file size %d",
f.MaxFileSize, f.MinFileSize))
return util.NewValidationError(fmt.Sprintf("invalid max file size %s, it is lesser or equal than min file size %s",
util.ByteCountSI(f.MaxFileSize), util.ByteCountSI(f.MinFileSize)))
}
}
if config.IsShared == 0 {