diff --git a/Cargo.lock b/Cargo.lock index ff5fffa..daf2af8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -655,7 +655,7 @@ dependencies = [ [[package]] name = "ngxav" -version = "0.4.6" +version = "0.4.7" dependencies = [ "chrono", "clap", diff --git a/Cargo.toml b/Cargo.toml index 3b74257..dd77977 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ workspace = { members = [ "tests","tests/obfuscate_access_log_ips"] } [package] name = "ngxav" -version = "0.4.6" +version = "0.4.7" edition = "2021" license = "MIT" description = "Search through NGINX logs with advanced filters and support for displaying analytics about your selected log entries" diff --git a/src/main.rs b/src/main.rs index 05c2eb6..ff6b283 100644 --- a/src/main.rs +++ b/src/main.rs @@ -15,6 +15,7 @@ use crate::structs::Args::ArgParser; use crate::utils::parse_line::parse_line; use std::{ + fs::metadata, fs::File, io::{self, BufRead, BufReader, Write}, path::Path, @@ -56,7 +57,8 @@ fn main() { return; } let mut lines = Vec::new(); - if args.file.contains("/") { + let file_md = metadata(args.file.clone()).unwrap(); + if file_md.is_dir() { lines = utils::read_folder::read_folder(args.file); } else { lines = lines_from_file(args.file).expect("should read");