fix: failed to parse certain image dimensions for Überzug++ backend (#2020)

This commit is contained in:
三咲雅 · Misaki Masa 2024-12-10 07:45:18 +08:00 committed by GitHub
parent 7498b97251
commit 0b340b67d5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 16 additions and 12 deletions

14
Cargo.lock generated
View file

@ -360,9 +360,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "chrono"
version = "0.4.38"
version = "0.4.39"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401"
checksum = "7e36cc9d416881d2e24f9a963be5fb1cd90966419ac844274161d10488b3e825"
dependencies = [
"android-tzdata",
"iana-time-zone",
@ -1397,9 +1397,9 @@ checksum = "03087c2bad5e1034e8cace5926dec053fb3790248370865f5117a7d0213354c8"
[[package]]
name = "libc"
version = "0.2.167"
version = "0.2.168"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09d6582e104315a817dff97f75133544b2e094ee22447d2acf4a74e189ba06fc"
checksum = "5aaeb2981e0606ca11d79718f8bb01164f1d6ed75080182d3abf017e6d244b6d"
[[package]]
name = "libfuzzer-sys"
@ -2210,15 +2210,15 @@ dependencies = [
[[package]]
name = "rustix"
version = "0.38.41"
version = "0.38.42"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d7f649912bc1495e167a6edee79151c84b1bad49748cb4f1f1167f459f6224f6"
checksum = "f93dc38ecbab2eb790ff964bb77fa94faf256fd3e73285fd7ba0903b76bedb85"
dependencies = [
"bitflags 2.6.0",
"errno",
"libc",
"linux-raw-sys",
"windows-sys 0.52.0",
"windows-sys 0.59.0",
]
[[package]]

View file

@ -19,7 +19,7 @@ crossterm = { version = "0.28.1", features = [ "event-stream" ] }
dirs = "5.0.1"
futures = "0.3.31"
globset = "0.4.15"
libc = "0.2.167"
libc = "0.2.168"
md-5 = "0.10.6"
mlua = { version = "0.10.2", features = [ "anyhow", "async", "error-send", "lua54", "macros", "serialize" ] }
parking_lot = "0.12.3"

View file

@ -1,6 +1,7 @@
use std::{path::{Path, PathBuf}, process::Stdio};
use anyhow::{Result, bail};
use image::ImageReader;
use ratatui::layout::Rect;
use tokio::{io::AsyncWriteExt, process::{Child, Command}, sync::mpsc::{self, UnboundedSender}};
use tracing::{debug, warn};
@ -47,7 +48,10 @@ impl Ueberzug {
};
let p = path.to_owned();
let (w, h) = tokio::task::spawn_blocking(move || image::image_dimensions(p)).await??;
let (w, h) = tokio::task::spawn_blocking(move || {
ImageReader::open(p)?.with_guessed_format()?.into_dimensions()
})
.await??;
let area = Dimension::ratio()
.map(|(r1, r2)| Rect {

View file

@ -14,13 +14,13 @@ These files are already included with Yazi when you install the release, so you
However, if you want to customize certain configurations:
- Create a `yazi.toml` in your config directory to override the settings in [`yazi-default.toml`][yazi-default], so either:
- Create a `yazi.toml` in your config directory to override certain settings in [`yazi-default.toml`][yazi-default], so either:
- `~/.config/yazi/yazi.toml` on Unix-like systems
- `C:\Users\USERNAME\AppData\Roaming\yazi\config\yazi.toml` on Windows
- Create a `keymap.toml` in your config directory to override the settings in [`keymap-default.toml`][keymap-default], so either:
- Create a `keymap.toml` in your config directory to override certain settings in [`keymap-default.toml`][keymap-default], so either:
- `~/.config/yazi/keymap.toml` on Unix-like systems
- `C:\Users\USERNAME\AppData\Roaming\yazi\config\keymap.toml` on Windows
- Create a `theme.toml` in your config directory to override the settings in [`theme-light.toml`][theme-light] and [`theme-dark.toml`][theme-dark], so either:
- Create a `theme.toml` in your config directory to override certain settings in [`theme-light.toml`][theme-light] and [`theme-dark.toml`][theme-dark], so either:
- `~/.config/yazi/theme.toml` on Unix-like systems
- `C:\Users\USERNAME\AppData\Roaming\yazi\config\theme.toml` on Windows