gateway.websocket: fix ETF encoding with a json pass

- icons: fix get guild banner handler args
This commit is contained in:
Luna 2019-03-15 03:54:40 -03:00
parent 2bc3817a4e
commit 7cd95d3f94
2 changed files with 11 additions and 2 deletions

View File

@ -81,7 +81,7 @@ async def _get_guild_splash(guild_id: int, icon_file: str):
return await send_icon('splash', guild_id, icon_hash, ext=ext)
@bp.route('/banners/<int:channel_id>/<icon_file>', methods=['GET'])
@bp.route('/banners/<int:guild_id>/<icon_file>', methods=['GET'])
async def _get_guild_banner(guild_id: int, icon_file: str):
icon_hash, ext = splitext_(icon_file)
return await send_icon('banner', guild_id, icon_hash, ext=ext)

View File

@ -74,7 +74,16 @@ def decode_json(data: str):
def encode_etf(payload) -> str:
return earl.pack(payload)
# The thing with encoding ETF is that with json we have LitecordJSONEncoder
# which takes care of converting e.g datetime objects to their ISO
# representation.
# so, to keep things working, i'll to a json pass on the payload, then send
# the decoded payload back to earl.
sanitized = encode_json(payload)
sanitized = decode_json(sanitized)
return earl.pack(sanitized)
def _etf_decode_dict(data):