From 5dad1f0d26e30bee94d48cc5f9dd81f4958da84c Mon Sep 17 00:00:00 2001 From: Ashley Wulber Date: Wed, 16 Jul 2025 16:55:15 -0400 Subject: [PATCH] fix: exit early from thumbnail generation if file is too big --- src/tab.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/tab.rs b/src/tab.rs index 742ade9..bc9906d 100644 --- a/src/tab.rs +++ b/src/tab.rs @@ -1756,8 +1756,11 @@ impl ItemThumbnail { let mut tried_supported_file = false; + if !check_size("image", 64 * 1000 * 1000) { + return ItemThumbnail::NotImage; + } // First try built-in image thumbnailer - if mime.type_() == mime::IMAGE && check_size("image", 64 * 1000 * 1000) { + if mime.type_() == mime::IMAGE { tried_supported_file = true; match image::ImageReader::open(path).and_then(|img| img.with_guessed_format()) { Ok(reader) => match reader.decode() {