fix: guess image format before decoding

This commit is contained in:
Ashley Wulber 2024-05-15 13:34:04 -04:00 committed by Jeremy Soller
parent 861e4f4075
commit e2444ab697
2 changed files with 4 additions and 2 deletions

2
Cargo.lock generated
View file

@ -5250,7 +5250,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.60",
"syn 2.0.63",
]
[[package]]

View file

@ -2407,7 +2407,9 @@ impl Tab {
|mut output| async move {
let (path, thumbnail) = tokio::task::spawn_blocking(move || {
let start = std::time::Instant::now();
let thumbnail = match image::io::Reader::open(&path) {
let thumbnail = match image::io::Reader::open(&path)
.and_then(|img| img.with_guessed_format())
{
Ok(reader) => match reader.decode() {
Ok(image) => {
//TODO: configurable thumbnail size?