Skip to content

Commit

Permalink
add back remote urls as simple passthru (#64)
Browse files Browse the repository at this point in the history
* drop support for remote urls

* add back urls
  • Loading branch information
jkelleyrtp authored Aug 13, 2024
1 parent 56faf4c commit b5b14cc
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions common/src/asset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,15 @@ impl AssetSource {
pub fn extension(&self) -> Option<String> {
match self {
Self::Local(path) => path.extension().map(|e| e.to_str().unwrap().to_string()),
Self::Remote(_url) => unimplemented!("no more remote urls!"),
Self::Remote(_url) => None,
}
}

/// Attempts to get the mime type of the file source
pub fn mime_type(&self) -> Option<String> {
match self {
Self::Local(path) => get_mime_from_path(path).ok().map(|mime| mime.to_string()),
Self::Remote(_url) => unimplemented!("no more remote urls!"),
Self::Remote(_url) => None,
}
}

Expand All @@ -108,7 +108,7 @@ impl AssetSource {
.map(|created| format!("{:?}", created))
})
}),
Self::Remote(_url) => unimplemented!("no more remote urls!"),
Self::Remote(_url) => None,
}
}

Expand All @@ -118,7 +118,7 @@ impl AssetSource {
AssetSource::Local(path) => Ok(std::fs::read_to_string(path).with_context(|| {
format!("Failed to read file from location: {}", path.display())
})?),
AssetSource::Remote(_url) => unimplemented!("no more remote urls!"),
AssetSource::Remote(_url) => Err(anyhow::anyhow!("no more remote urls!")),
}
}

Expand All @@ -128,9 +128,7 @@ impl AssetSource {
AssetSource::Local(path) => Ok(std::fs::read(path).with_context(|| {
format!("Failed to read file from location: {}", path.display())
})?),
AssetSource::Remote(_url) => {
unimplemented!("no more remote urls!")
}
AssetSource::Remote(_url) => Err(anyhow::anyhow!("no more remote urls!")),
}
}
}
Expand Down

0 comments on commit b5b14cc

Please sign in to comment.