0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-06-25 21:38:18 +02:00

modules/media/thumbnail: Skip animation check if it won't be thumbnailed anyway.

This commit is contained in:
Jason Volk 2021-02-09 23:01:10 -08:00
parent 2a34c748bb
commit f7293581ec

View file

@ -279,6 +279,19 @@ get__thumbnail_local(client &client,
split(content_type, ';').first
};
const bool supported
{
// Available in build
#ifdef IRCD_USE_MAGICK
(true)
#else
(false)
#endif
// Enabled by configuration
&& enable
};
const bool permitted
{
// If there's a blacklist, mime type must not in the blacklist.
@ -293,6 +306,9 @@ get__thumbnail_local(client &client,
// Administrator's fuse to disable animation detection.
bool(animation_enable)
// Only call into libpng if magick is supported/enabled
&& supported
// If the type is not permitted don't bother checking for animation.
&& permitted
@ -311,11 +327,8 @@ get__thumbnail_local(client &client,
const bool fallback // Reasons to just send the original image
{
// Not available in build
!IRCD_USE_MAGICK
// Disabled by configuration
|| !enable
// Thumbnailer support not enabled or available
!supported
// Access denied for this operation
|| !permitted