Skip to content
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

Add using casing check/fix for initMountPoints #1915

Merged
merged 5 commits into from
Nov 3, 2016
Merged

Conversation

MorrisJobke
Copy link
Member

@MorrisJobke MorrisJobke added 3. to review Waiting for reviews downstream labels Oct 25, 2016
@MorrisJobke MorrisJobke added this to the Nextcloud 11.0 milestone Oct 25, 2016
@mention-bot
Copy link

@MorrisJobke, thanks for your PR! By analyzing the history of the files in this pull request, we identified @nickvergessen, @icewind1991 and @DeepDiver1975 to be potential reviewers.

@MorrisJobke
Copy link
Member Author

I tested this code and at least my tests didn't revealed anything bad.


if (is_null($ownerUser)) {
\OCP\Util::writeLog('files', ' Backends provided no user object for ' . $ownerUser, \OCP\Util::ERROR);
throw new \OC\User\NoUserException('Backends provided no user object for ' . $ownerUser);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer not adding potential user controlled content to the exception.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Btw shouldnt the isnull check gp againsr userObject?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

… that probably too … or be below L147. Good catch ❗️

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

be below L147. Good catch

This makes no sense, because if the userObject is null then the method will crash. 😉

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah. But this checks for $ownerUser and not $userObject? $ownerUser is according to PHPDoc a string.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep - that's the reason why @nickvergessen comment is correct ;)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah. Gotcha. I thought you referred to our comments 🙈

@MorrisJobke MorrisJobke added 2. developing Work in progress and removed 3. to review Waiting for reviews labels Oct 25, 2016
@MorrisJobke MorrisJobke self-assigned this Oct 25, 2016
@MorrisJobke MorrisJobke added 3. to review Waiting for reviews and removed 2. developing Work in progress labels Oct 26, 2016
@MorrisJobke MorrisJobke removed their assignment Oct 26, 2016
@MorrisJobke
Copy link
Member Author

@nickvergessen @LukasReschke I fixed the issues. Please review again 🤔

@@ -136,6 +136,15 @@ public static function isEnabled() {
* not '/admin/data/file.txt'
*/
public static function getUsersSharingFile($path, $ownerUser, $includeOwner = false, $returnUserPaths = false, $recursive = true) {
$userManager = \OC::$server->getUserManager();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DI ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Static code 🙈

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me also look into that…

Copy link
Member

@LukasReschke LukasReschke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me try to do some changes here to make the code cleaner.

@@ -347,6 +347,15 @@ public function getName() {
* @return \OCP\Files\Folder
*/
public function getUserFolder($userId) {
$userObject = \OC::$server->getUserManager()->get($userId);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DI

$userObject = \OC::$server->getUserManager()->get($userId);

if (is_null($userObject)) {
\OCP\Util::writeLog('files', 'Backends provided no user object for ' . $userId, \OCP\Util::ERROR);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DI

@@ -136,6 +136,15 @@ public static function isEnabled() {
* not '/admin/data/file.txt'
*/
public static function getUsersSharingFile($path, $ownerUser, $includeOwner = false, $returnUserPaths = false, $recursive = true) {
$userManager = \OC::$server->getUserManager();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me also look into that…

$userObject = $userManager->get($ownerUser);

if (is_null($userObject)) {
\OCP\Util::writeLog('files', ' Backends provided no user object for ' . $ownerUser, \OCP\Util::ERROR);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DI

@LukasReschke LukasReschke dismissed their stale review November 2, 2016 22:28

Adjusted the code to use DI and added some tests where possible.

@LukasReschke
Copy link
Member

LukasReschke commented Nov 2, 2016

@MorrisJobke @nickvergessen Did some changes so we have proper DI. Best to go through commits, 90% of it are test changes. Please review.

LGTM for me on the original changes.

Also cc @icewind1991 since it's filesystem stuff.

@MorrisJobke
Copy link
Member Author

👍 for @LukasReschke changes

@LukasReschke LukasReschke merged commit b33ceb6 into master Nov 3, 2016
@LukasReschke LukasReschke deleted the downstream-26398 branch November 3, 2016 11:14
@blizzz
Copy link
Member

blizzz commented Jan 3, 2018

😭

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants