mirror of
https://github.com/qodo-ai/pr-agent.git
synced 2025-12-15 04:15:18 +00:00
fix: return empty string for None or empty PR title in cleaning method
This commit is contained in:
parent
d9eb0367cf
commit
447a384aee
1 changed files with 3 additions and 1 deletions
|
|
@ -761,7 +761,9 @@ class PRDescription:
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def clean_title(title: str) -> str:
|
def clean_title(title: str) -> str:
|
||||||
"""Clean the PR title by normalizing all whitespace to a single space and stripping leading/trailing spaces."""
|
"""Clean the PR title by normalizing all whitespace to a single space and stripping leading/trailing spaces. Returns empty string if input is None or empty."""
|
||||||
|
if not title:
|
||||||
|
return ""
|
||||||
return re.sub(r'\s+', ' ', title.strip())
|
return re.sub(r'\s+', ' ', title.strip())
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue