tree_magic icon indicating copy to clipboard operation
tree_magic copied to clipboard

from_filepath and match_filepath seem to disagree for "text/html"

Open commonquail opened this issue 8 years ago • 0 comments

Cargo.toml:

[package]
name = "blah"
version = "0.1.0"

[dependencies]
tree_magic="0.2.0"

index.html:

<!DOCTYPE html>

src/lib.rs:

extern crate tree_magic;

#[cfg(test)]
mod tests {

    use super::*;
    use std::path::Path;

    static MIME: &str = "text/html";
    static FILE: &str = "index.html";

    #[test]
    fn from_filepath() {
        assert_eq!(MIME, tree_magic::from_filepath(Path::new(FILE)));
    }

    #[test]
    fn match_filepath() {
        assert!(tree_magic::match_filepath(MIME, Path::new(FILE)));
    }
}

Running cargo test on the above project shows ´from_filepathpassing andmatch_filepathfailing.from_filepath` seems to pass as long as the HTML file has DOCTYPE html, ignoring everything else.

commonquail avatar May 21 '17 18:05 commonquail