Skip to content

Commit

Permalink
params has always keys in _execute_request()
Browse files Browse the repository at this point in the history
  • Loading branch information
mib1185 committed Jan 5, 2025
1 parent 68082e9 commit 8f62661
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/synology_dsm/synology_dsm.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,14 +342,11 @@ async def _execute_request(
self, method: str, url: URL, params: dict, **kwargs: Any
) -> bytes | dict | str:
"""Function to execute and handle a request."""
if params:
# special handling for spaces in parameters
# because yarl.URL does encode a space as + instead of %20
# safe extracted from yarl.URL._QUERY_PART_QUOTER
query = urlencode(params, safe="?/:@-._~!$'()*,", quote_via=quote)
url_encoded = url.join(URL(f"?{query}", encoded=True))
else:
url_encoded = url
# special handling for spaces in parameters
# because yarl.URL does encode a space as + instead of %20
# safe extracted from yarl.URL._QUERY_PART_QUOTER
query = urlencode(params, safe="?/:@-._~!$'()*,", quote_via=quote)
url_encoded = url.join(URL(f"?{query}", encoded=True))

try:
if method == "GET":
Expand Down

0 comments on commit 8f62661

Please sign in to comment.