fix: Hostnamen normalisieren (Schema/Slash strippen) + freundlichere Nextcloud-Fehler
Bug: nextcloudhost mit https://-Präfix in CSV/GUI führte zu Doppel-Schema (https://https://cloud.foo.de) und damit zu DNS-Fehler "host=https". - models.clean_host() entfernt http(s):// und Trailing-Slash; Account ruft das im __post_init__ für plesk-/kerio-/nextcloudhost auf. - NextcloudClient wickelt requests-Connection-Fehler in NextcloudError ein, damit die Log-Ausgabe lesbar bleibt statt HTTPSConnectionPool-Stacktrace. - README: Hostname-Eingabe als tolerant dokumentiert; pleskhost-Pflicht im manual-Modus klarer (POP3-Sammler braucht es trotzdem). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -2,6 +2,19 @@ from dataclasses import dataclass, field
|
||||
from typing import List, Optional
|
||||
|
||||
|
||||
def clean_host(s: str) -> str:
|
||||
"""`https://cloud.foo.de/` → `cloud.foo.de`.
|
||||
|
||||
Akzeptiert die Eingaben unabhängig davon, ob der User Schema/Slash
|
||||
mit eingetippt hat. Verhindert Doppel-Schemas wie
|
||||
`https://https://cloud.foo.de` beim Bauen von URLs.
|
||||
"""
|
||||
s = (s or "").strip()
|
||||
if "://" in s:
|
||||
s = s.split("://", 1)[1]
|
||||
return s.rstrip("/")
|
||||
|
||||
|
||||
@dataclass
|
||||
class Account:
|
||||
name: str
|
||||
@@ -16,6 +29,12 @@ class Account:
|
||||
nextcloudspeicher: Optional[int] = None # GB; None = unlimitiert
|
||||
nextcloudkennwort: str = ""
|
||||
|
||||
def __post_init__(self):
|
||||
self.pleskhost = clean_host(self.pleskhost)
|
||||
self.keriohost = clean_host(self.keriohost)
|
||||
self.nextcloudhost = clean_host(self.nextcloudhost)
|
||||
self.emailadresse = (self.emailadresse or "").strip()
|
||||
|
||||
@property
|
||||
def vollname(self) -> str:
|
||||
return f"{self.vorname} {self.name}".strip()
|
||||
|
||||
Reference in New Issue
Block a user