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

DI of OCP\Files\Folder fails for guests #11184

Closed
nickvergessen opened this issue Sep 12, 2018 · 2 comments
Closed

DI of OCP\Files\Folder fails for guests #11184

nickvergessen opened this issue Sep 12, 2018 · 2 comments

Comments

@nickvergessen
Copy link
Member

E.g.

TypeError
Argument 4 passed to OCA\Comments\Controller\Notifications::__construct() must implement interface OCP\Files\Folder, null given

The problem is, that the UserFolder is returned as null instead of something like e.g. NonExistingFolder

$this->registerService(IAppData::class, function (SimpleContainer $c) {
return $this->getServer()->getAppDataDir($c->query('AppName'));
});

So either all apps which use Folder injection need to allow = null manually or they will throw if one of the roots is invoked by a guest.

@icewind1991 do you think NonExistingFolder would make sense, or should we just advice all consumers of the app to explicitly allow null or inject IRootFolder instead and get the folder once they are sure it's a logged in user.

@nextcloud-bot
Copy link
Member

GitMate.io thinks possibly related issues are #3636 (Update fails), #2737 (Updater fails to complete), #4683 (SharedStorageTest::testGetPermissions fails), #2043 (DI Container improvements), and #8299 (Decryption failed with s3).

@nickvergessen
Copy link
Member Author

inject IRootFolder instead and get the folder once they are sure it's a logged in user.

After thinking a bit about it, I guess that this is actually the best idea, so fix is in #11185

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

No branches or pull requests

2 participants