diff --git a/litecord/blueprints/guild/emoji.py b/litecord/blueprints/guild/emoji.py index db53c07..9f6bcf2 100644 --- a/litecord/blueprints/guild/emoji.py +++ b/litecord/blueprints/guild/emoji.py @@ -105,7 +105,7 @@ async def _put_emoji(guild_id): size=(128, 128), ) - if not icon: + if icon is None: return "", 400 # TODO: better way to detect animated emoji rather than just gifs, @@ -172,10 +172,11 @@ async def _del_emoji(guild_id, emoji_id): await app.db.execute( """ DELETE FROM guild_emoji - WHERE id = $2 + WHERE id = $1 """, emoji_id, ) await _dispatch_emojis(guild_id) return "", 204 + diff --git a/litecord/blueprints/icons.py b/litecord/blueprints/icons.py index a01509e..ef38700 100644 --- a/litecord/blueprints/icons.py +++ b/litecord/blueprints/icons.py @@ -31,7 +31,7 @@ async def send_icon(scope, key, icon_hash, **kwargs): """Send an icon.""" icon = await app.icons.generic_get(scope, key, icon_hash, **kwargs) - if not icon: + if icon is None: return "", 404 return await send_file(icon.as_path) @@ -44,8 +44,6 @@ def splitext_(filepath): @bp.route("/emojis/", methods=["GET"]) async def _get_raw_emoji(emoji_file): - # emoji = app.icons.get_emoji(emoji_id, ext=ext) - # just a test file for now emoji_id, ext = splitext_(emoji_file) return await send_icon("emoji", emoji_id, None, ext=ext) @@ -110,3 +108,4 @@ async def _get_guild_splash(guild_id: int, icon_file: str): 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) + diff --git a/litecord/images.py b/litecord/images.py index 6b01327..a28bd48 100644 --- a/litecord/images.py +++ b/litecord/images.py @@ -333,7 +333,7 @@ class IconManager: *args, ) - if not icon_row: + if icon_row is None: return None icon = Icon(icon_row["key"], icon_row["hash"], icon_row["mime"]) @@ -371,9 +371,6 @@ class IconManager: # get an extension for the given data uri extension = get_ext(mime) - if "bsize" in kwargs and len(raw_data) > kwargs["bsize"]: - return _invalid(kwargs) - # size management is different for gif files # as they're composed of multiple frames. if "size" in kwargs and mime == "image/gif": @@ -529,3 +526,4 @@ class IconManager: await self.delete(old_icon) return await self.put(scope, key, new_icon_data, **kwargs) +