nextcloud / nextcloud/server

Autocomplete user search API does not partial match the current user

Open
#48,180 5 comments 9 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

1. to develop 31-feedback bug enhancement feature: sharing
Dominant language
PHP
Stars
36.9k
Forks
5.2k
Avg merge
2d 3h
Merged PRs (30d)
713

Description

⚠️ This issue respects the following points: ⚠️
Bug description

When making a query to the autocomplete API, the currently authenticated user does not show up in the results, unless the full user name is provided.

Steps to reproduce
full name (shows result)

curl -i -u admin:admin -X GET -H "OCS-APIRequest: true" 'http://nextcloud.local/ocs/v2.php/core/autocomplete/get?search=admin'

<?xml version="1.0"?>
<ocs>
 <meta>
  <status>ok</status>
  <statuscode>200</statuscode>
  <message>OK</message>
 </meta>
 <data>
  <element>
   <id>admin</id>
   <label>admin</label>
   <icon>icon-user</icon>
   <source>users</source>
   <status></status>
   <subline></subline>
   <shareWithDisplayNameUnique>admin@example.net</shareWithDisplayNameUnique>
  </element>
 </data>
</ocs>

partial name (no result)

curl -i -u admin:admin -X GET -H "OCS-APIRequest: true" 'http://nextcloud.local/ocs/v2.php/core/autocomplete/get?search=ad'

<?xml version="1.0"?>
<ocs>
 <meta>
  <status>ok</status>
  <statuscode>200</statuscode>
  <message>OK</message>
 </meta>
 <data/>
</ocs>

only happens for currently authenticated user, partial matches work for other users

curl -i -u admin:admin -X GET -H "OCS-APIRequest: true" 'http://nextcloud.local/ocs/v2.php/core/autocomplete/get?search=ja'

<?xml version="1.0"?>
<ocs>
 <meta>
  <status>ok</status>
  <statuscode>200</statuscode>
  <message>OK</message>
 </meta>
 <data>
  <element>
   <id>jane</id>
   <label>jane</label>
   <icon>icon-user</icon>
   <source>users</source>
   <status></status>
   <subline></subline>
   <shareWithDisplayNameUnique>jane</shareWithDisplayNameUnique>
  </element>
 </data>
</ocs>
Expected behavior

Partial searches should work

Nextcloud Server version

master

Operating system

Debian/Ubuntu

PHP engine version

None

Web server

None

Database engine version

None

Is this bug present after an update or on a fresh install?

None

Are you using the Nextcloud Server Encryption module?

None

What user-backends are you using?
  • Default user-backend (database)
  • LDAP/ Active Directory
  • SSO - SAML
  • Other
Configuration report

No response

List of activated Apps

No response

Nextcloud Signing status

No response

Nextcloud Logs

No response

Additional info

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the OCS autocomplete endpoint with the provided curl requests, comparing the full-name and partial-name searches for the authenticated user. Trace the server-side handling of /ocs/v2.php/core/autocomplete/get and verify that a partial search returns the current user as it already does for other users.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.