fix: exit early from thumbnail generation if file is too big
This commit is contained in:
parent
a37b27e7e4
commit
5dad1f0d26
1 changed files with 4 additions and 1 deletions
|
|
@ -1756,8 +1756,11 @@ impl ItemThumbnail {
|
||||||
|
|
||||||
let mut tried_supported_file = false;
|
let mut tried_supported_file = false;
|
||||||
|
|
||||||
|
if !check_size("image", 64 * 1000 * 1000) {
|
||||||
|
return ItemThumbnail::NotImage;
|
||||||
|
}
|
||||||
// First try built-in image thumbnailer
|
// 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;
|
tried_supported_file = true;
|
||||||
match image::ImageReader::open(path).and_then(|img| img.with_guessed_format()) {
|
match image::ImageReader::open(path).and_then(|img| img.with_guessed_format()) {
|
||||||
Ok(reader) => match reader.decode() {
|
Ok(reader) => match reader.decode() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue