From 7096cf70d365a4c423c4ff24965529eed56e1e9f Mon Sep 17 00:00:00 2001 From: Ricardo Pardini Date: Sun, 15 Jan 2023 17:14:02 +0100 Subject: [PATCH] armbian-next: `patching`: remove quotes from author name during parsing --- lib/tools/common/patching_utils.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/tools/common/patching_utils.py b/lib/tools/common/patching_utils.py index fbb68b223..c102d2f6d 100644 --- a/lib/tools/common/patching_utils.py +++ b/lib/tools/common/patching_utils.py @@ -277,10 +277,10 @@ class PatchInPatchFile: self.problems.append("invalid_author") log.warning( f"Failed to parse name and email from: '{from_str}' while parsing patch {self.counter} in file {self.parent.full_file_path()}") - return downgrade_to_ascii(from_str), "unknown-email@domain.tld" + return downgrade_to_ascii(remove_quotes(from_str)), "unknown-email@domain.tld" else: # Return the name and email - return downgrade_to_ascii(m.group("name")), m.group("email") + return downgrade_to_ascii(remove_quotes(m.group("name"))), remove_quotes(m.group("email")) def one_line_patch_stats(self) -> str: files_desc = ", ".join(self.patched_file_stats_dict) @@ -713,6 +713,10 @@ def downgrade_to_ascii(utf8: str) -> str: return unidecode(utf8) +def remove_quotes(utf8: str) -> str: + return utf8.replace('"', '') + + # Try hard to read a possibly invalid utf-8 file def read_file_as_utf8(file_name: str) -> tuple[str, list[str]]: with open(file_name, "rb") as f: