zowe / zowe/zowe-client-python-sdk
`_encode_uri_path_for_uss` does not skip encoded URIs
Open
@aadityasinha-dotcom is already working on this.
Since Sep 10, 2026.
- #415 by @aadityasinha-dotcom — open
bug
priority-low
severity-low
- Dominant language
- Python
- Stars
- 44
- Forks
- 38
- Avg merge
- 1d 3h
- Merged PRs (30d)
- 1
Description
Describe the bug
_encode_uri_path_for_uss function does not acknowledge encoding on a URI given as input, which can result in invalid URI encoding sequences.
Expected and actual results
Expected: _encode_uri_path_for_uss should either skip encoded URIs, or at least have a note on the function clarifying that it should not be used with a URI that's already encoded.
Actual: The function encodes the URI again, causing incorrect URI encoding.
Example Python logic to detect and return early for this case:
from urllib.parse import unquote
def is_uri_encoded(uri: str) -> bool:
"""Returns True if the URI contains percent-encoded characters."""
return uri != unquote(uri)
# Examples
print(is_uri_encoded("https://example.com%20world")) # True
print(is_uri_encoded("https://example.com world")) # False
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.
Assessment
This issue has not been assessed yet.