Skip to content

REST: Stop double-encoding the parent namespace in list_namespaces - #4112

Open
DG47 wants to merge 2 commits into
apache:mainfrom
DG47:fix/rest-list-namespaces-parent-encoding
Open

DG47 wants to merge 2 commits into
apache:mainfrom
DG47:fix/rest-list-namespaces-parent-encoding

Conversation

@DG47

@DG47 DG47 commented Oct 15, 2026

Copy link
Copy Markdown

Closes #4111

Rationale for this change

list_namespaces passes the parent namespace through requests' params, which URL-encodes query values. The parts were already quoted by _encode_namespace_path (which is meant for path segments), so any part containing a space, /, % or a non-ASCII character went out encoded twice. For example, the server received my%20namespace instead of my namespace and could not find the parent. This started when the query string moved to params= in #3347.

This change joins the raw parts with the configured namespace separator and leaves encoding to requests. That matches the Java client, where RESTUtil.namespaceToQueryParam joins the levels without encoding them and the server reads the value back with namespaceFromQueryParam. Path parameters still go through _encode_namespace_path, so they are unchanged.

Are these changes tested?

Yes. There are new tests in tests/catalog/test_rest.py. They decode the query string the way a server would and check that parent equals the separator-joined namespace, using parts that contain a space, /, % and non-ASCII characters, plus a custom namespace-separator. Without the fix, five of these cases fail. With the fix, all of them pass. make test and make lint pass.

Are there any user-facing changes?

Yes, a bug fix: list_namespaces(parent) now works on REST catalogs when the parent namespace contains characters that need URL encoding.

DG47 and others added 2 commits October 15, 2026 12:46
list_namespaces passes the parent namespace through requests' params,
which URL-encodes query values. The namespace parts were already quoted
with _encode_namespace_path, so any part containing a space, '/', '%'
or non-ASCII character was encoded twice and the server received e.g.
"my%20namespace" instead of "my namespace". Join the raw parts with the
namespace separator instead, matching RESTUtil.namespaceToQueryParam in
the Java client.

This branch has not been deployed

No deployments
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.

REST: list_namespaces double-encodes the parent namespace query parameter

1 participant