Skip to content

Commit 87d74c6

Browse files
committed
fixed bugs
1 parent 391e1d5 commit 87d74c6

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
workspace = { members = [ "tests","tests/obfuscate_access_log_ips"] }
22
[package]
33
name = "ngxav"
4-
version = "0.4.8"
4+
version = "0.4.9"
55
edition = "2021"
66
license = "MIT"
77
description = "Search through NGINX logs with advanced filters and support for displaying analytics about your selected log entries"

src/utils/read_folder_conserve_memory.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,13 @@ use std::fs::File;
88
use std::io::{BufRead, BufReader};
99

1010
pub fn read_folder_conserve_memory(file_path: String, isUnique: Option<bool>) {
11-
println!("{}", "step zero");
1211
let mut paths: Vec<_> = fs::read_dir(file_path).unwrap().collect();
1312
paths.sort_by_key(|x| {
1413
metadata(x.as_ref().unwrap().path().to_str().unwrap())
1514
.unwrap()
1615
.modified()
1716
.unwrap()
1817
});
19-
println!("{}", "step one");
2018
let mut occurrences: HashMap<String, bool> = HashMap::new();
2119
for path in paths {
2220
let p: String = path.unwrap().path().to_str().unwrap().to_string();
@@ -28,7 +26,11 @@ pub fn read_folder_conserve_memory(file_path: String, isUnique: Option<bool>) {
2826
Ok(line) => {
2927
let ip: String =
3028
line.clone().split(" ").collect::<Vec<&str>>()[0].to_string();
31-
if keep_line(&parse_line(&line), true) {
29+
30+
if line.chars().filter(|c| *c == '"').count() > 4
31+
&& line.len() > 20
32+
&& keep_line(&parse_line(&line), true)
33+
{
3234
if isUnique.is_some() && isUnique.unwrap() == true {
3335
if !occurrences.contains_key(&ip) {
3436
println!("{}", line.clone() + "\n");

0 commit comments

Comments
 (0)