diff --git a/httpie/cli/argparser.py b/httpie/cli/argparser.py index 9bf09b3b73..c2e6be2e3e 100644 --- a/httpie/cli/argparser.py +++ b/httpie/cli/argparser.py @@ -5,7 +5,7 @@ import sys from argparse import RawDescriptionHelpFormatter from textwrap import dedent -from urllib.parse import urlsplit +from urllib.parse import urlsplit, unquote from requests.utils import get_netrc_auth @@ -291,6 +291,9 @@ def _process_auth(self): # Handle http://username:password@hostname/ username = url.username password = url.password or '' + # Decode percent-encoded characters in username and password + username = unquote(username) + password = unquote(password) self.args.auth = AuthCredentials( key=username, value=password, @@ -306,7 +309,7 @@ def _process_auth(self): if (not self.args.ignore_netrc and self.args.auth is None and plugin.netrc_parse): - # Only host needed, so it’s OK URL not finalized. + # Only host needed, so it's OK URL not finalized. netrc_credentials = get_netrc_auth(self.args.url) if netrc_credentials: self.args.auth = AuthCredentials( @@ -377,7 +380,7 @@ def _apply_no_options(self, no_options): invalid.append(option) if invalid: - self.error(f'unrecognized arguments: {" ".join(invalid)}') + self.error(f'unrecognized arguments: {"".join(invalid)}') def _body_from_file(self, fd): """Read the data from a file-like object. @@ -610,4 +613,4 @@ def error(self, message): '''.rstrip() ) ) - self.exit(2) + self.exit(2) \ No newline at end of file