lib.Uri.query: Add property
All checks were successful
CI / Packaging - Kali Linux (pull_request) Successful in 4m58s
CI / Packaging - OpenSUSE Tumbleweed (pull_request) Successful in 5m14s
CI / Packaging test (pull_request) Successful in 0s

lib.Uri doesn't support query strings, and this commit adds support: Expose
the query as a property, keep it through the path replacement methods, and
show it in the full forms.

Signed-off-by: Jan Lindemann <jan@janware.com>
Assisted-by: unsloth/Qwen3.8-27B-GGUF:Q4_K_M with pi.dev v1.4.0
This commit is contained in:
Jan Lindemann 2026-10-31 15:56:08 +01:00
commit d6f622e000
Signed by: Jan Lindemann
GPG key ID: 3750640C9E25DD61

View file

@ -96,4 +96,17 @@ assert u.to_string == 'ssh://user:pass@host:22/path'
u = Uri('https://user:secret@example.com/repo.git')
assert '<hidden>' in str(u)
# The query is identity, not path: it is exposed, it survives a
# path change, and it shows in the full form
u = Uri('kvfile://host/?pkg-filter=url=~jw.dev')
assert u.query == 'pkg-filter=url=~jw.dev'
assert u.path == '/'
assert u.new_replace_path('etc/foo.conf').to_string == \
'kvfile://host/etc/foo.conf?pkg-filter=url=~jw.dev'
u = Uri('kvfile:///?pkg-filter=url=~jw.dev')
assert u.new_replace_path('etc').to_string == \
'kvfile:///etc?pkg-filter=url=~jw.dev'
assert 'pkg-filter=url=~jw.dev' in u.full
assert Uri('ssh://host/path').query == ''
print('All Uri tests passed')