Fix crash in case of vanity code and not found
divent / lint (push) Successful in 2m50s Details
divent / docker (push) Successful in 2m47s Details
divent / pypi (push) Has been skipped Details

This commit is contained in:
Michel Roux 2023-11-07 02:12:55 +01:00
parent f49f69cc79
commit f7779ace60
1 changed files with 8 additions and 2 deletions

View File

@ -221,7 +221,10 @@ async def subscribe(entity_id: str):
entity_id=guild.vanity_url_code or guild.id,
)
user = await client.get_or_fetch_user(int(entity_id))
try:
user = await client.get_or_fetch_user(int(entity_id))
except ValueError:
return redirect(url_for(".login"))
if user and str(user.id) == entity_id:
return await render_template(
@ -281,7 +284,10 @@ async def ical(entity_id: str):
return calendar.serialize()
user = await client.get_or_fetch_user(int(entity_id))
try:
user = await client.get_or_fetch_user(int(entity_id))
except ValueError:
return redirect(url_for(".login"))
if user:
calendar = Calendar()