-
-
Notifications
You must be signed in to change notification settings - Fork 759
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
check for multiple inverse matches #1332
check for multiple inverse matches #1332
Conversation
Hello, thank you for your contribution. I'll give a look the next weekend. Can you please fix the DCO check in the meantime? |
internal/common/eventmanager.go
Outdated
return false | ||
} | ||
} else if checkEventConditionPattern(p, name) { | ||
matches = true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we just return true
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes that possible, will update that
This patch can be merged but please apply the same logic also in sftpgo/internal/common/eventmanager.go Line 1161 in 76964a6
to have uniform behavior. Thank you! |
Hello drakkan, |
Thank you, but please fix the DCO check. I'll do some tests with groups this weekend to make sure the behavior is uniform. |
Yes, just saw it. Will fix them. |
Signed-off-by: David Stäheli <mistrdave@gmail.com>
Signed-off-by: David Stäheli <mistrdave@gmail.com>
Signed-off-by: David Stäheli <mistrdave@gmail.com>
Signed-off-by: David Stäheli <mistrdave@gmail.com>
1235cc9
to
099c56d
Compare
checkEventGroupConditionPatterns seems not consistent, for example if you have something like this
I think the check should return |
Hello @mistadave thank you again for this contribution. We have recently updated our contribution policy and we now require signing a CLA. Agreeing to the CLA clarifies your rights as a contributor and at the same time protects SFTPGo and its users. More details here You can use the following URL to sign the CLA https://cla-assistant.io/drakkan/sftpgo?pullRequest=1332 Thank you! |
Current behaviour
The check
checkEventConditionPatterns
returns after first match is true, which doesn't allow to check multiple wildcards inverse.New behaviour
This change allows in the event rules to set multiple path filters with inverse matches.
Which allows for matching to any kind of file except for those inverse matches (acts as an exclusions list).
All tests on the eventmanager_test.go passed.
Known limitations
Probably doesn't work with mixed path filters. Which I think does not make sense anyway, because a matching pattern always exclude any other inverse matches.
Changes