Skip to content

Commit

Permalink
Improve is_image detection to actually detect images (excluding video…
Browse files Browse the repository at this point in the history
…s) and add content_type value
  • Loading branch information
khakers committed Aug 3, 2023
1 parent 9a9afb4 commit 47913f5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,17 @@ however, insignificant breaking changes do not guarantee a major version bump, s
# [UNRELEASED]

### Breaking
- Completely rewritten blocklist system. Blocklisting now runs off it's own mongoDB collection. This once again introduces backwards incompatible schema changes, so a manual migration is required. You may upgrade from both v4.0 and v4.1 using the `[p]migrate blocklist` command. This removes any need to perform the previous migration steps in v4.1.0, you may upgrade directly to this version. After running the command, blocklist functionality will return and legacy config based blocks will have been deleted. You should always backup your config before migration.
- Completely rewritten blocklist system. Blocklisting now runs off its own mongoDB collection. This once again introduces backwards incompatible schema changes, so a manual migration is required. You may upgrade from both v4.0 and v4.1 using the `[p]migrate blocklist` command. This removes any need to perform the previous migration steps in v4.1.0, you may upgrade directly to this version. After running the command, blocklist functionality will return and legacy config based blocks will have been deleted. You should always back up your config before migration.

### Deprecated
- Legacy blocklist properties are deprecated and no longer function. They now log a warning when used and provide no functionality. They have been replaced with methods in blocklist.py

### Added
- Added `content_type` to attachments stored in the database.

### Fixed
- Persistent notes have been fixed after the previous discord.py update.
- `is_image` now is true only if the image is actually an image.

# v4.1.0

Expand Down
4 changes: 3 additions & 1 deletion core/clients.py
Original file line number Diff line number Diff line change
Expand Up @@ -666,9 +666,11 @@ async def append_log(
{
"id": a.id,
"filename": a.filename,
"is_image": a.width is not None,
# In previous versions this was true for both videos and images
"is_image": a.content_type.startswith("image/"),
"size": a.size,
"url": a.url,
"content_type": a.content_type,
}
for a in message.attachments
],
Expand Down

0 comments on commit 47913f5

Please sign in to comment.