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

This commit is contained in:
Michel Roux 2023-11-07 02:12:55 +01:00
parent f49f69cc79
commit f7779ace60

View File

@ -221,7 +221,10 @@ async def subscribe(entity_id: str):
entity_id=guild.vanity_url_code or guild.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()
try:
user = await client.get_or_fetch_user(int(entity_id))
except ValueError:
return redirect(url_for(".login"))
if user:
calendar = Calendar()