[feat] check file is a file
This commit is contained in:
@@ -84,6 +84,13 @@ fn check_auth(fpath: String, auth: String) -> bool{
|
||||
println!("File {} does not exist", path.display());
|
||||
return false;
|
||||
}
|
||||
|
||||
// check file is a file
|
||||
if !path.is_file() {
|
||||
println!("File {} is not a file", path.display());
|
||||
return false;
|
||||
}
|
||||
|
||||
// check file size
|
||||
let size = std::fs::metadata(&fpath).unwrap().len();
|
||||
|
||||
@@ -94,6 +101,7 @@ fn check_auth(fpath: String, auth: String) -> bool{
|
||||
}
|
||||
|
||||
|
||||
|
||||
// read file
|
||||
let got_auth = std::fs::read_to_string(&path).expect("Something went wrong reading the file");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user