Skip to content

fix(acl): do not double-encode the search query in the sharing sidebar - #5146

Open
mckeydonelly wants to merge 1 commit into
nextcloud:masterfrom
mckeydonelly:fix/acl-search-double-encoding
Open

mckeydonelly wants to merge 1 commit into
nextcloud:masterfrom
mckeydonelly:fix/acl-search-double-encoding

Conversation

@mckeydonelly

Copy link
Copy Markdown

Summary

In the "Advanced permissions for Team folder" section of the sharing sidebar, searching for a user, group or team returns "No results" as soon as the query contains a non-ASCII character or a space.

searchMappings() wraps the query in encodeURIComponent() and then passes it to generateUrl(), which encodes its parameters again. The server receives the literal percent-encoded string and matches nothing:

Input Sent before Sent after
Макс search=%25D0%259C%25D0%25B0%25D0%25BA%25D1%2581 search=%D0%9C%D0%B0%D0%BA%D1%81
John Smith search=John%2520Smith search=John%20Smith
John search=John search=John

Plain single-word ASCII queries are unaffected, which is why this is easy to miss. The matching entry also flashes briefly before disappearing, because the select filters the already loaded options client-side until the empty server response replaces them.

The fix drops the extra encodeURIComponent() call.

How to test

  1. Create a Team folder with advanced permissions enabled and assign a group to it
  2. Add a user with a non-ASCII display name (e.g. Максим Ригосик) to that group
  3. Open the sharing sidebar for the folder → "Add new rule"
  4. Type the beginning of the display name

Before: "No results". After: the user is listed.

Tested on Nextcloud 33.0.9 with groupfolders 21.0.15, where the same code is shipped. A backport to stable33 would be appreciated.

🤖 AI (if applicable)

  • The content of this PR was partly or fully generated using AI

generateUrl() already URL-encodes its parameters, so wrapping the query in
encodeURIComponent() encoded it twice. The server then searched for the
literal percent-encoded string, so any query containing non-ASCII
characters or a space returned no results.

Signed-off-by: Alexey Orlov <mckeydonelly@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant