Problem found in create share of group folder files via OCS share api

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face: is for home/non-enterprise users. If you’re running a business, paid support can be accessed via where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:


Or for longer, use three backticks above and below the code snippet:


Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can :heart:

Nextcloud version (eg, 12.0.2): 16.0.5
Operating system and version (eg, Ubuntu 17.04):centos7.5
Apache or nginx version (eg, Apache 2.4.25): 2.4.27
PHP version (eg, 7.1): 7.2

The issue you are facing:
When we use ocs api to create share for a file in group folder, the Manager.php under lib/private/Share20 will throw exception in Line 325. The problem is caused by $permissions is not defined. So I add this cmd to solve it. But I am not sure is it Ok.
if (!isset($permissions)) $permissions=\OCP\Constants::PERMISSION_READ;

Is this the first time you’ve seen this error? (Y/N):Y

Steps to replicate it:

The output of your Nextcloud log in Admin > Logging:


The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

in the nextcloud log slide
problem found in create share of group folder files via OCS share api

The output of your Apache/nginx/system log in `/var/log/____`:
no problem found at there


I ran into this issue as well.

Seems that you have to set the cookie in order to get it work for group folders. Let me know if it works! :slight_smile:

the problem is not existed in postman but in my java code communiting the ocs api of nextcloud. did u mean that cookie of postman helps me to prevent from the defined variable problem?

Yes. Make sure your java code sets the cookie. Postman probably automatically sets the cookie for you.

I have checked the postman, no cookie is set. By the way, if I set cookie, what is the cookie name I should use?

Alright strange. This would be the ‘right’ call for now. Meanwhile Julius from Nextcloud made a pull request to fix this issue to put it in line with general non group folder behavior.

Everything redacted though is important.

I am not very familiar with java development but this looks like it could solve the issue you are facing for the cookiecontainer.

I have inserted the cookies to the request of the post, but still does not work for the group folder sharing. When I use the curl tool, it has CSRF check error. I dont understand why POSTMAN can make it.