Skip to content

Autocomplete user search API does not partial match the current user #48180

@enjeck

Description

@enjeck

⚠️ 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

Metadata

Metadata

Assignees

No one assigned

    Projects

    Status

    🧭 Planning evaluation (don't pick)

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions