Handle 404 fetch if the channel id doesnt exist

This commit is contained in:
Jeremy Zhang 2017-08-09 01:31:20 +00:00
parent 146b2311cf
commit 08a90c8a51

View File

@ -333,6 +333,8 @@ def fetch():
session['user_keys'].pop(guild_id, None) session['user_keys'].pop(guild_id, None)
else: else:
chan = filter_guild_channel(guild_id, channel_id) chan = filter_guild_channel(guild_id, channel_id)
if not chan:
abort(404)
if not chan.get("read"): if not chan.get("read"):
status_code = 401 status_code = 401
else: else:
@ -352,6 +354,8 @@ def fetch_visitor():
abort(403) abort(403)
messages = {} messages = {}
chan = filter_guild_channel(guild_id, channel_id, True) chan = filter_guild_channel(guild_id, channel_id, True)
if not chan:
abort(404)
if not chan.get("read"): if not chan.get("read"):
status_code = 401 status_code = 401
else: else: