use empty control when trying to get existing home in user sync#36365
use empty control when trying to get existing home in user sync#36365karakayasemi merged 1 commit intomasterfrom
Conversation
3f6b173 to
3991fea
Compare
Codecov Report
@@ Coverage Diff @@
## master #36365 +/- ##
=========================================
Coverage ? 64.86%
Complexity ? 19788
=========================================
Files ? 1271
Lines ? 74730
Branches ? 1309
=========================================
Hits ? 48477
Misses ? 25867
Partials ? 386
Continue to review full report at Codecov.
|
3991fea to
eb3d97a
Compare
lib/private/User/SyncService.php
Outdated
| // Home is handled differently, it should only be set on account creation, when there is no home already set | ||
| // Otherwise it could change on a sync and result in a new user folder being created | ||
| if ($a->getHome() === null) { | ||
| if (empty($a->getHome()) && $a->getHome() !== '0') { |
There was a problem hiding this comment.
The best way to go is not expect null from the method with signature * @method string getHome() I understand that Account::getHome is more tricky to fix. But as for me I'd better cast $a->getHome() result to string and use a strict comparison here: if ((string) $a->getHome() === '') {
VicDeo
left a comment
There was a problem hiding this comment.
@karakayasemi did you consider adding
public function getHome() {
return (string) $this->getter('home');
}
into OC\User\Account class to ensure that getHome can't be null?
98dd573 to
d67b536
Compare
d67b536 to
80a3e1a
Compare
|
@VicDeo I tried to solve the return type problem in Finally, I applied your suggestion to ensure |
80a3e1a to
246a068
Compare
|
Drone tests passed. I rebased the branch to trigger the missing codecov report. |
phil-davis
left a comment
There was a problem hiding this comment.
LGTM. I will look in the CI logs when CI is done.
Codecov Report
@@ Coverage Diff @@
## master #36365 +/- ##
============================================
+ Coverage 64.86% 64.87% +<.01%
- Complexity 19788 19789 +1
============================================
Files 1271 1271
Lines 74729 74731 +2
Branches 1309 1309
============================================
+ Hits 48476 48478 +2
Misses 25867 25867
Partials 386 386
Continue to review full report at Codecov.
|
|
An older example acceptance test run: https://drone.owncloud.com/owncloud/core/21169/39/11 The same acceptance test suite log from today, e.g. https://drone.owncloud.com/owncloud/core/21178/39/11 does not have those entries. Good |
|
Good to see these results. I realized the problem from acceptance test suite logs. Make them readable was one of the aims. |
Description
The server is producing unintended error logs in every user creation. This bug fixed with proper condition control. Also, since we are making lots of add/delete users in test scenarios, acceptance tests log files are full of this log, like https://drone.owncloud.com/owncloud/encryption/977/60/11 . This PR will make test log files more readable.
Related Issue
Motivation and Context
More readable log file without false positives.
How Has This Been Tested?
Use test steps given in the related issues. The error log will not be generated.
Screenshots (if appropriate):
Types of changes
Checklist: