Merge pull request #23 from leiserfg/handle-file-schema

Remove schema from x-scheme-handler/file files
This commit is contained in:
Gregory 2020-10-12 12:26:42 -04:00 committed by GitHub
commit ba3c87c305
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -29,6 +29,9 @@ impl TryFrom<&str> for MimeType {
fn try_from(arg: &str) -> Result<Self> { fn try_from(arg: &str) -> Result<Self> {
if let Ok(url) = url::Url::parse(arg) { if let Ok(url) = url::Url::parse(arg) {
if url.scheme() == "file" {
return Self::try_from(url.path())
}
Ok(Self( Ok(Self(
format!("x-scheme-handler/{}", url.scheme()) format!("x-scheme-handler/{}", url.scheme())
.parse::<Mime>() .parse::<Mime>()