mirror of
https://github.com/sxyazi/yazi.git
synced 2024-11-24 01:48:00 +03:00
fix: unknown mime-type of inode/x-empty
(#36)
This commit is contained in:
parent
d9624cf42f
commit
e123137823
@ -59,6 +59,7 @@ impl Preview {
|
||||
|
||||
self.handle = Some(tokio::spawn(async move {
|
||||
let result = match kind {
|
||||
MimeKind::Empty => Ok(PreviewData::None),
|
||||
MimeKind::Archive => Self::archive(&path).await.map(PreviewData::Text),
|
||||
MimeKind::Dir => Self::folder(&path).await,
|
||||
MimeKind::Image => Self::image(&path).await,
|
||||
|
@ -2,6 +2,8 @@ pub const MIME_DIR: &str = "inode/directory";
|
||||
|
||||
#[derive(Clone, Copy, PartialEq, Eq)]
|
||||
pub enum MimeKind {
|
||||
Empty,
|
||||
|
||||
Archive,
|
||||
Dir,
|
||||
|
||||
@ -17,6 +19,10 @@ pub enum MimeKind {
|
||||
|
||||
impl MimeKind {
|
||||
pub fn valid(s: &str) -> bool {
|
||||
if s == "inode/x-empty" {
|
||||
return true;
|
||||
}
|
||||
|
||||
let parts = s.split('/').collect::<Vec<_>>();
|
||||
if parts.len() != 2 {
|
||||
return false;
|
||||
@ -47,6 +53,8 @@ impl MimeKind {
|
||||
Self::Image
|
||||
} else if s.starts_with("video/") {
|
||||
Self::Video
|
||||
} else if s == "inode/x-empty" {
|
||||
Self::Empty
|
||||
} else if s == "application/json" {
|
||||
Self::JSON
|
||||
} else if s == "application/pdf" {
|
||||
|
Loading…
Reference in New Issue
Block a user