diff options
author | Vincent Driessen <me@nvie.com> | 2016-05-30 16:26:43 +0200 |
---|---|---|
committer | Vincent Driessen <me@nvie.com> | 2016-05-30 16:33:59 +0200 |
commit | 79c99c0f66c8f3c8d13258376c82125a23b1b5c8 (patch) | |
tree | 0f85e1eafed98ae7321237c0bba9108a136826c0 /git/objects/commit.py | |
parent | 0eafe201905d85be767c24106eb1ab12efd3ee22 (diff) | |
download | gitpython-79c99c0f66c8f3c8d13258376c82125a23b1b5c8.tar.gz |
Ignore invalid data when decoding commit objectsfix-for-invalid-data-in-commits
Previously, GitPython chokes on this while decoding. Rather than
choking, instead accept the error and replace the invalid bytes by the
� (\x80) char.
Diffstat (limited to 'git/objects/commit.py')
-rw-r--r-- | git/objects/commit.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/git/objects/commit.py b/git/objects/commit.py index dc722f97..58a8912f 100644 --- a/git/objects/commit.py +++ b/git/objects/commit.py @@ -501,14 +501,14 @@ class Commit(base.Object, Iterable, Diffable, Traversable, Serializable): try: self.author, self.authored_date, self.author_tz_offset = \ - parse_actor_and_date(author_line.decode(self.encoding)) + parse_actor_and_date(author_line.decode(self.encoding, errors='replace')) except UnicodeDecodeError: log.error("Failed to decode author line '%s' using encoding %s", author_line, self.encoding, exc_info=True) try: self.committer, self.committed_date, self.committer_tz_offset = \ - parse_actor_and_date(committer_line.decode(self.encoding)) + parse_actor_and_date(committer_line.decode(self.encoding, errors='replace')) except UnicodeDecodeError: log.error("Failed to decode committer line '%s' using encoding %s", committer_line, self.encoding, exc_info=True) @@ -518,7 +518,7 @@ class Commit(base.Object, Iterable, Diffable, Traversable, Serializable): # The end of our message stream is marked with a newline that we strip self.message = stream.read() try: - self.message = self.message.decode(self.encoding) + self.message = self.message.decode(self.encoding, errors='replace') except UnicodeDecodeError: log.error("Failed to decode message '%s' using encoding %s", self.message, self.encoding, exc_info=True) # END exception handling |