mirror of https://gitlab.com/litecord/litecord.git
gateway.websocket: fix ETF encoding with a json pass
- icons: fix get guild banner handler args
This commit is contained in:
parent
2bc3817a4e
commit
7cd95d3f94
|
|
@ -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)
|
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):
|
async def _get_guild_banner(guild_id: int, icon_file: str):
|
||||||
icon_hash, ext = splitext_(icon_file)
|
icon_hash, ext = splitext_(icon_file)
|
||||||
return await send_icon('banner', guild_id, icon_hash, ext=ext)
|
return await send_icon('banner', guild_id, icon_hash, ext=ext)
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,16 @@ def decode_json(data: str):
|
||||||
|
|
||||||
|
|
||||||
def encode_etf(payload) -> 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):
|
def _etf_decode_dict(data):
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue