Autocomplete user search API does not partial match the current user
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 36.9k
- Forks
- 5.2k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 713
Description
⚠️ This issue respects the following points: ⚠️
- This is a bug, not a question or a configuration/webserver/proxy issue.
- This issue is not already reported on Github OR Nextcloud Community Forum (I've searched it).
- Nextcloud Server is up to date. See Maintenance and Release Schedule for supported versions.
- I agree to follow Nextcloud's Code of Conduct.
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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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