-
Notifications
You must be signed in to change notification settings - Fork 14
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
Validation for max allowed number of chars in custom groups name #291
Conversation
27e407b
to
b85ad48
Compare
Codecov Report
@@ Coverage Diff @@
## master #291 +/- ##
=========================================
Coverage 83.34% 83.34%
Complexity 316 316
=========================================
Files 22 22
Lines 1015 1015
=========================================
Hits 846 846
Misses 169 169 Continue to review full report at Codecov.
|
@pako81 @phil-davis I have added some acceptance tests for the validation of custom group names length. |
@dpakach thanks! |
@dpakach codecov is failing |
7665a5d
to
fd00855
Compare
I rebased just now to get the PR up-to-date and fresh CI |
@phil-davis Yes, indeed, we need more coverage. Currently no dev available. Needs planning. |
I added unit test cases for long group name validation. It turned out to be easy, and codecov is happy. |
@PVince81 We need some JS know how to review this. Could you? 😄 |
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.
Changes seem harmless, also there are similar checks in the changed files. LGTM 👍
/** Group name must be max 64 characters long */ | ||
if (\mb_strlen($name, 'UTF-8') > 64) { | ||
throw new ValidationException('The group name should be maximum 64 characters long.'); | ||
} |
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.
createGroup() is also called by public function createDirectory() -- should we validate the name there too?
Description
Add validation for maximum allowed number of characters in custom groups names.
Related Issue
Motivation and Context
Since we have already a check in place about the minimum number of chars a custom group name should be (2), it would make sense to also add a check for the maximum length, catch the exception and display a proper warning to the end-user. Currently, no warning is given back to the end-user and an exception is logged in the owncloud.log file.
How Has This Been Tested?
Manually, by trying to create a new / rename an existing custom group having name longer than 64 chars and check that the above-mentioned exception is correctly caught and a proper warning is displayed to the end-user.
Types of changes