Can't share to a local User

Hey, first sorry for my bad englisch ;).

Nextcloud version (eg, 10.0.2): 11.0.3
Operating system and version (eg, Ubuntu 16.04): Ubuntu 16.04
Apache or nginx version (eg, Apache 2.4.25): 2.4.18
PHP version (eg, 5.6): 7.0.15
Is this the first time you’ve seen this error?: It’s the first time

Can you reliably replicate it? (If so, please outline steps):

The issue you are facing:
I have a few users and I can share anything to a few of them, but if I search for a new user or group Nextcloud can’t find this user or the group. But the User / the Group exists!

The output of your Nextcloud log in Admin > Logging:
Undefined index: FN at /var/www/owncloud/current/apps/files_sharing/lib/Controller/ShareesAPIController.php#585

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):
$CONFIG = array (
‘instanceid’ => ‘REMOVED’,
‘passwordsalt’ => ‘REMOVED’,
‘secret’ => ‘REMOVED’,
‘trusted_domains’ =>
array (
** REMOVED **
),
‘datadirectory’ => ‘/festplatte2/owncloud/data’,
‘dbtype’ => ‘mysql’,
‘version’ => ‘11.0.3.2’,
‘dbname’ => ‘cloud’,
‘dbhost’ => ‘localhost’,
‘dbtableprefix’ => ‘REMOED’,
‘dbuser’ => ‘REMOVED’,
‘dbpassword’ => ‘REMOVED’,
‘logtimezone’ => ‘Europe/Berlin’,
‘loglevel’ => ‘2’,
‘logfile’ => ‘/var/log/owncloud/owncloud.log’,
‘log_authfailip’ => true,
‘installed’ => true,
‘appstore.experimental.enabled’ => false,
‘mail_smtpmode’ => ‘smtp’,
‘mail_from_address’ => ‘cloud’,
‘mail_domain’ => ‘REMOVED’,
‘mail_smtpauthtype’ => ‘LOGIN’,
‘mail_smtpauth’ => 1,
‘mail_smtphost’ => ‘REMOVED’,
‘mail_smtpport’ => ‘465’,
‘mail_smtpname’ => ‘REMOVED’,
‘mail_smtppassword’ => ‘REMOVED’,
‘mail_smtpsecure’ => ‘ssl’,
‘maintenance’ => false,
‘theme’ => ‘HenrysTheme’,
‘memcache.local’ => ‘\OC\Memcache\Redis’,
‘redis’ =>
array (
‘host’ => ‘localhost’,
‘port’ => 6379,
),
‘ldapIgnoreNamingRules’ => false,
‘knowledgebaseenabled’ => false,
‘updater.release.channel’ => ‘stable’,
‘enable_avatars’ => true,
‘singleuser’ => false,
);

The output of your Apache/nginx/system log in /var/log/____:
Same output like in the admin log. (Undifined Index, Variable not found, the Error is in the ShareesAPIController.php!

I have exactly the same issue. I cannot share anything with a few users. If i search the users cannot be found for sharing.

Bump !!! This is still an issue on 12

Same issue here.
This is the error message that I see when I am looking for the username “pa” in the Share textbox.

{"reqId":"GbRsBwUz91FuUd2NI169","level":3,"time":"2017-08-13T06:27:43+00:00","remoteAddr":"1.2.3.4","user":"photos","app":"no app in context","method":"GET","url":"\/ocs\/v1.php\/apps\/files_sharing\/api\/v1\/sharees?format=json&search=pa&perPage=200&itemType=folder","message":"Exception: {\"Exception\":\"InvalidArgumentException\",\"Message\":\"Invalid cloud id\",\"Code\":0,\"Trace\":\"#0 \\\/path\\\/to\\\/folder\\\/nextcloud\\\/apps\\\/files_sharing\\\/lib\\\/Controller\\\/ShareesAPIController.php(626): OC\\\\Federation\\\\CloudIdManager->resolveCloudId('pab@')\\n#1 \\\/path\\\/to\\\/folder\\\/nextcloud\\\/apps\\\/files_sharing\\\/lib\\\/Controller\\\/ShareesAPIController.php(553): OCA\\\\Files_Sharing\\\\Controller\\\\ShareesAPIController->getEmail('pa')\\n#2 \\\/path\\\/to\\\/folder\\\/nextcloud\\\/apps\\\/files_sharing\\\/lib\\\/Controller\\\/ShareesAPIController.php(492): OCA\\\\Files_Sharing\\\\Controller\\\\ShareesAPIController->searchSharees('pa', 'folder', Array, 1, 200, true)\\n#3 [internal function]: OCA\\\\Files_Sharing\\\\Controller\\\\ShareesAPIController->search('pa', 'folder', 1, 200, NULL, true)\\n#4 \\\/path\\\/to\\\/folder\\\/nextcloud\\\/lib\\\/private\\\/AppFramework\\\/Http\\\/Dispatcher.php(160): call_user_func_array(Array, Array)\\n#5 \\\/path\\\/to\\\/folder\\\/nextcloud\\\/lib\\\/private\\\/AppFramework\\\/Http\\\/Dispatcher.php(90): OC\\\\AppFramework\\\\Http\\\\Dispatcher->executeController(Object(OCA\\\\Files_Sharing\\\\Controller\\\\ShareesAPIController), 'search')\\n#6 \\\/path\\\/to\\\/folder\\\/nextcloud\\\/lib\\\/private\\\/AppFramework\\\/App.php(114): OC\\\\AppFramework\\\\Http\\\\Dispatcher->dispatch(Object(OCA\\\\Files_Sharing\\\\Controller\\\\ShareesAPIController), 'search')\\n#7 \\\/path\\\/to\\\/folder\\\/nextcloud\\\/lib\\\/private\\\/AppFramework\\\/Routing\\\/RouteActionHandler.php(47): OC\\\\AppFramework\\\\App::main('ShareesAPIContr...', 'search', Object(OC\\\\AppFramework\\\\DependencyInjection\\\\DIContainer), Array)\\n#8 [internal function]: OC\\\\AppFramework\\\\Routing\\\\RouteActionHandler->__invoke(Array)\\n#9 \\\/path\\\/to\\\/folder\\\/nextcloud\\\/lib\\\/private\\\/Route\\\/Router.php(299): call_user_func(Object(OC\\\\AppFramework\\\\Routing\\\\RouteActionHandler), Array)\\n#10 \\\/path\\\/to\\\/folder\\\/nextcloud\\\/ocs\\\/v1.php(77): OC\\\\Route\\\\Router->match('\\\/ocsapp\\\/apps\\\/fi...')\\n#11 {main}\",\"File\":\"\\\/path\\\/to\\\/folder\\\/nextcloud\\\/lib\\\/private\\\/Federation\\\/CloudIdManager.php\",\"Line\":68}","userAgent":"Mozilla\/5.0 (X11; Linux x86_64; rv:54.0) Gecko\/20100101 Firefox\/54.0","version":"12.0.1.5"}

As a consequence, I cannot share anything with use “pab” that does exist.

OK, the behavior can be repaired by removing the email address attached to the account!!! I dont understand why… If anyone can offer some help…

The faulty behavior may have been introduced here:

Of interest, a freshly created user with an email address is not impacted by the faulty behavior.

To summarize,

  • after upgrade to NC 12, users created in the past with an email address are impacted by a bug (“invalid cloud id”) which prevents other users to share folders with them (it is even more insidious than that: the “invalid cloud id” bug prevents the suggestion menu from popping up…
  • this bug comes from a new code in this commit: https://github.com/nextcloud/server/pull/5428/files ; the CLOUD value that the contacts manager finds is invalid (for example, for user pab, it is “pab@” which is then seen as invalid by resolveCloudId function
  • a new user created with an email address after NC 12 deployment does not raise any issue

I need help to understand where the contactsManager finds the CLOUD value (is there a field or something else in the database for this?) in this extract of code:

$addressBookContacts = $this->contactsManager->search($search, ['EMAIL', 'FN']);
foreach ($addressBookContacts as $contact) {
  if (isset($contact['isLocalSystemBook'])) {
	if ($exactEmailMatch) {
	    $cloud = $this->cloudIdManager->resolveCloudId($contact['CLOUD'][0]);
    }
  }   
 }

This bug was fixed here: see https://github.com/nextcloud/server/issues/3457 and https://github.com/nextcloud/server/pull/6099.

This post can be put as resolved.

1 Like

Okay, sorry for my late respone, i’ve marked this post as solved. Thanks.