Skip to content

Commit

Permalink
fix: telegram_admins validation
Browse files Browse the repository at this point in the history
  • Loading branch information
SaintShit committed Jan 29, 2024
1 parent 6058215 commit cf22c90
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/models/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class Config:

@property
def telegram_admins(self):
return list(map(int, self.telegram_admin_ids.strip(',').split(',')))
return list(map(int, filter(bool, ((self.telegram_admin_ids or '').strip(',').split(',')))))


class SettingsModify(Settings):
Expand All @@ -61,7 +61,7 @@ def validate_dashboard_path(cls, value):
@validator('telegram_admin_ids')
def validate_telegram_admin_ids(cls, value):
try:
list(map(int, value.strip(',').split(',')))
list(map(int, filter(bool, ((value or '').strip(',').split(',')))))
except ValueError as exc:
v = str(exc).replace("invalid literal for int() with base 10: '", '')[:-1].strip()
raise ValueError(f'\'{v}\' is not a valid Telegram ID')
Expand Down

0 comments on commit cf22c90

Please sign in to comment.