mirror of https://gitlab.com/litecord/litecord.git
Pull request #4: Bugfix/emoji creation deletion
Merge in LIT/litecord from bugfix/emoji-creation-deletion to master * commit 'fdb2afcd3666428664612f1711d18ab1a35bd10d': Fixed broken check & query Fixed broken check Removed and fixed broken checks
This commit is contained in:
commit
a4148bd616
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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/<emoji_file>", 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)
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue