From a0da57a293e51f66fba18ee287f0738a4c2e0781 Mon Sep 17 00:00:00 2001 From: sxyazi Date: Sun, 12 Nov 2023 11:31:22 +0800 Subject: [PATCH] fix: unable to clear preview image on can't get mimetype --- yazi-core/src/manager/commands/peek.rs | 2 +- yazi-shared/src/mime.rs | 6 +----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/yazi-core/src/manager/commands/peek.rs b/yazi-core/src/manager/commands/peek.rs index 0eb247e1..da9723cd 100644 --- a/yazi-core/src/manager/commands/peek.rs +++ b/yazi-core/src/manager/commands/peek.rs @@ -18,7 +18,7 @@ impl Manager { } let Some(mime) = self.mimetype.get(url).cloned() else { - return false; + return self.active_mut().preview.reset(|_| true); }; if sequent { diff --git a/yazi-shared/src/mime.rs b/yazi-shared/src/mime.rs index 3d629b2d..b4add0cb 100644 --- a/yazi-shared/src/mime.rs +++ b/yazi-shared/src/mime.rs @@ -49,17 +49,13 @@ impl MimeKind { } pub fn valid(s: &str) -> bool { - if s == "inode/x-empty" { - return true; - } - let parts = s.split('/').collect::>(); if parts.len() != 2 { return false; } #[rustfmt::skip] - let b = matches!(parts[0], "application" | "audio" | "example" | "font" | "image" | "message" | "model" | "multipart" | "text" | "video"); + let b = matches!(parts[0], "application" | "audio" | "example" | "font" | "image" | "inode" | "message" | "model" | "multipart" | "text" | "video"); b && !parts[1].is_empty() }