Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit79c99c0

Browse files
committed
Ignore invalid data when decoding commit objects
Previously, GitPython chokes on this while decoding. Rather thanchoking, instead accept the error and replace the invalid bytes by the� (\x80) char.
1 parent0eafe20 commit79c99c0

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

‎git/objects/commit.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -501,14 +501,14 @@ def _deserialize(self, stream):
501501

502502
try:
503503
self.author,self.authored_date,self.author_tz_offset= \
504-
parse_actor_and_date(author_line.decode(self.encoding))
504+
parse_actor_and_date(author_line.decode(self.encoding,errors='replace'))
505505
exceptUnicodeDecodeError:
506506
log.error("Failed to decode author line '%s' using encoding %s",author_line,self.encoding,
507507
exc_info=True)
508508

509509
try:
510510
self.committer,self.committed_date,self.committer_tz_offset= \
511-
parse_actor_and_date(committer_line.decode(self.encoding))
511+
parse_actor_and_date(committer_line.decode(self.encoding,errors='replace'))
512512
exceptUnicodeDecodeError:
513513
log.error("Failed to decode committer line '%s' using encoding %s",committer_line,self.encoding,
514514
exc_info=True)
@@ -518,7 +518,7 @@ def _deserialize(self, stream):
518518
# The end of our message stream is marked with a newline that we strip
519519
self.message=stream.read()
520520
try:
521-
self.message=self.message.decode(self.encoding)
521+
self.message=self.message.decode(self.encoding,errors='replace')
522522
exceptUnicodeDecodeError:
523523
log.error("Failed to decode message '%s' using encoding %s",self.message,self.encoding,exc_info=True)
524524
# END exception handling

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp