Skip to content

Commit

Permalink
fix(http): escape / in url parameters (#1264)
Browse files Browse the repository at this point in the history
  • Loading branch information
shiftinv authored Dec 29, 2024
1 parent 3e3b27b commit 18535bb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions changelog/1264.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Escape forward slashes in HTTP route parameters.
6 changes: 5 additions & 1 deletion disnake/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,11 @@ def __init__(self, method: str, path: str, **parameters: Any) -> None:
url = self.BASE + self.path
if parameters:
url = url.format_map(
{k: _uriquote(v) if isinstance(v, str) else v for k, v in parameters.items()}
{
# `/` should not be considered a safe character by default
k: _uriquote(v, safe="") if isinstance(v, str) else v
for k, v in parameters.items()
}
)
self.url: str = url

Expand Down

0 comments on commit 18535bb

Please sign in to comment.