Fix url encoding of strings with slashes in URLs (#3263)
Fixes https://github.com/PyGithub/PyGithub/issues/3262. This changes the URL encoding function used for strings in URLs. Currently, this uses `urllib.parse.quote`, which makes an exclusion of URL-encoding the `/` character: > urllib.parse.quote(string, safe='/', encoding=None, errors=None) Replace special characters in string using the %xx escape. Letters, digits, and the characters '_.-~' are never quoted. By default, this function is intended for quoting the path section of a URL. The optional safe parameter specifies additional ASCII characters that should not be quoted — its default value is '/'. The GitHub APIs expect that `/` _should_ be URL encoded. For example, if my environment name contains `/` I get a 404 from the GitHub API. I have modified the call to remove this exclusion for the `/` character, which causes the environment name to be correctly encoded. I have updated the test cases to provide coverage for this change. --------- Co-authored-by: Enrico Minack <github@enrico.minack.dev>
O
Oscar van Leusen committed
da73fc8ac3d73341c971f881c773275ad19ba2ee
Parent: f51a3f4
Committed by GitHub <noreply@github.com>
on 7/30/2025, 4:36:22 PM