add source.rs

This commit is contained in:
pybt 2022-05-30 20:18:04 +07:00
parent c6603e3882
commit d2a89c66ab

9
src/utils/source.rs Normal file
View File

@ -0,0 +1,9 @@
use std::path::Path;
use regex::Regex;
pub fn validate_source(source: &str) -> bool
{
let re = Regex::new(r"^https?://.*").unwrap();
return Path::new(&source).is_file() || re.is_match(&source);
}