mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2025-01-06 01:27:24 +03:00
chore: handle errors when converting line content to UTF-8 in hunks_by_filepath function
This commit is contained in:
parent
644a4ae3f3
commit
ea097b7d8b
@ -137,7 +137,11 @@ fn hunks_by_filepath(
|
||||
match line.origin() {
|
||||
'+' | '-' | ' ' => {
|
||||
current_diff.push_str(&format!("{}", line.origin()));
|
||||
current_diff.push_str(str::from_utf8(line.content()).unwrap());
|
||||
current_diff.push_str(
|
||||
str::from_utf8(line.content())
|
||||
.map_err(|error| tracing::error!(?error, ?file_path))
|
||||
.unwrap_or_default(),
|
||||
);
|
||||
current_binary = false;
|
||||
}
|
||||
'B' => {
|
||||
@ -151,7 +155,11 @@ fn hunks_by_filepath(
|
||||
current_binary = true;
|
||||
}
|
||||
_ => {
|
||||
current_diff.push_str(std::str::from_utf8(line.content()).unwrap());
|
||||
current_diff.push_str(
|
||||
str::from_utf8(line.content())
|
||||
.map_err(|error| tracing::error!(?error, ?file_path))
|
||||
.unwrap_or_default(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user