fix: do not traceback on invalid jids in config.get_by_servname

This commit is contained in:
mathieui 2021-04-20 18:55:56 +02:00
parent e3f9af4a35
commit e03f802e41

View file

@ -20,7 +20,7 @@ from pathlib import Path
from typing import Dict, List, Optional, Union, Tuple, cast, Any
from poezio import xdg
from slixmpp import JID
from slixmpp import JID, InvalidJID
log = logging.getLogger(__name__) # type: logging.Logger
@ -278,7 +278,10 @@ class Config:
"""
Try to get the value of an option for a server
"""
server = JID(jid).server
try:
server = JID(jid).server
except InvalidJID:
server = ''
if server:
server = '@' + server
if server in self.sections() and option in self.options(server):