diff --git a/litecord/blueprints/icons.py b/litecord/blueprints/icons.py index 046e22c..c9ffcf3 100644 --- a/litecord/blueprints/icons.py +++ b/litecord/blueprints/icons.py @@ -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//', methods=['GET']) diff --git a/litecord/images.py b/litecord/images.py index 1fa2bbd..c33979d 100644 --- a/litecord/images.py +++ b/litecord/images.py @@ -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