sanetja les descripcions per evitar salts de línia
This commit is contained in:
+6
-1
@@ -118,6 +118,11 @@ def gitea_get(cfg: Config, path: str, params: dict[str, str] | None = None) -> t
|
|||||||
raise RuntimeError(f"no se pudo contactar con {cfg.url}: {e.reason}") from e
|
raise RuntimeError(f"no se pudo contactar con {cfg.url}: {e.reason}") from e
|
||||||
|
|
||||||
|
|
||||||
|
def _oneline(s: str) -> str:
|
||||||
|
"""Col·lapsa qualsevol salt de línia o whitespace múltiple en un sol espai."""
|
||||||
|
return " ".join((s or "").split())
|
||||||
|
|
||||||
|
|
||||||
def _parse_repo_list(body: bytes) -> list[RemoteRepo]:
|
def _parse_repo_list(body: bytes) -> list[RemoteRepo]:
|
||||||
items = json.loads(body or b"[]")
|
items = json.loads(body or b"[]")
|
||||||
return [
|
return [
|
||||||
@@ -126,7 +131,7 @@ def _parse_repo_list(body: bytes) -> list[RemoteRepo]:
|
|||||||
full_name=item.get("full_name", ""),
|
full_name=item.get("full_name", ""),
|
||||||
clone_url=item.get("clone_url", ""),
|
clone_url=item.get("clone_url", ""),
|
||||||
ssh_url=item.get("ssh_url", ""),
|
ssh_url=item.get("ssh_url", ""),
|
||||||
description=item.get("description") or "",
|
description=_oneline(item.get("description") or ""),
|
||||||
private=bool(item.get("private", False)),
|
private=bool(item.get("private", False)),
|
||||||
default_branch=item.get("default_branch") or "main",
|
default_branch=item.get("default_branch") or "main",
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user