From 85fe2735b7c9119804813bcbbdd8d14018291ed3 Mon Sep 17 00:00:00 2001 From: Glenn Matthews Date: Wed, 4 May 2022 12:48:09 -0400 Subject: Fix #1284: strip usernames from URLs as well as passwords --- git/exc.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'git/exc.py') diff --git a/git/exc.py b/git/exc.py index e8ff784c..045ea9d2 100644 --- a/git/exc.py +++ b/git/exc.py @@ -8,6 +8,7 @@ from gitdb.exc import BadName # NOQA @UnusedWildImport skipcq: PYL-W0401, PYL-W0614 from gitdb.exc import * # NOQA @UnusedWildImport skipcq: PYL-W0401, PYL-W0614 from git.compat import safe_decode +from git.util import remove_password_if_present # typing ---------------------------------------------------- @@ -54,7 +55,7 @@ class CommandError(GitError): stdout: Union[bytes, str, None] = None) -> None: if not isinstance(command, (tuple, list)): command = command.split() - self.command = command + self.command = remove_password_if_present(command) self.status = status if status: if isinstance(status, Exception): @@ -66,8 +67,8 @@ class CommandError(GitError): s = safe_decode(str(status)) status = "'%s'" % s if isinstance(status, str) else s - self._cmd = safe_decode(command[0]) - self._cmdline = ' '.join(safe_decode(i) for i in command) + self._cmd = safe_decode(self.command[0]) + self._cmdline = ' '.join(safe_decode(i) for i in self.command) self._cause = status and " due to: %s" % status or "!" stdout_decode = safe_decode(stdout) stderr_decode = safe_decode(stderr) -- cgit v1.2.1