mirror of https://gitlab.com/litecord/litecord.git
blueprints.icons: send none hash when querying emoji
- images: handle hash being none on generic_get
This commit is contained in:
parent
1175de1406
commit
d3bc826504
|
|
@ -26,7 +26,7 @@ async def _get_raw_emoji(emoji_file):
|
|||
# just a test file for now
|
||||
emoji_id, ext = splitext_(emoji_file)
|
||||
return await send_icon(
|
||||
'emoji', emoji_id, emoji_id, ext=ext)
|
||||
'emoji', emoji_id, None, ext=ext)
|
||||
|
||||
|
||||
@bp.route('/icons/<int:guild_id>/<icon_file>', methods=['GET'])
|
||||
|
|
|
|||
|
|
@ -165,7 +165,14 @@ class IconManager:
|
|||
log.debug('GET {} {} {}', scope, key, icon_hash)
|
||||
key = str(key)
|
||||
|
||||
hash_query = 'AND hash = $3' if key else ''
|
||||
hash_query = 'AND hash = $3' if icon_hash else ''
|
||||
|
||||
# hacky solution to only add icon_hash
|
||||
# when needed.
|
||||
args = [scope, key]
|
||||
|
||||
if icon_hash:
|
||||
args.append(icon_hash)
|
||||
|
||||
icon_row = await self.storage.db.fetchrow(f"""
|
||||
SELECT key, hash, mime
|
||||
|
|
@ -173,7 +180,7 @@ class IconManager:
|
|||
WHERE scope = $1
|
||||
AND key = $2
|
||||
{hash_query}
|
||||
""", scope, key, icon_hash)
|
||||
""", *args)
|
||||
|
||||
if not icon_row:
|
||||
return None
|
||||
|
|
|
|||
Loading…
Reference in New Issue