Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion crates/rwalk/src/cli/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,9 @@ pub fn parse_key_or_keyval(s: &str) -> Result<(String, Option<String>)> {
if parts.len() > 2 {
return Err(syntax_error!((0, s.len()), s, "Expected at most one ':'"));
}
Ok((parts[0].to_lowercase(), parts.get(1).map(|s| s.to_string())))
let key = parts[0].to_string(); // ← no lowercase here
let value = parts.get(1).map(|s| s.to_string());
Ok((key, value))
}

pub fn parse_wordlist(s: &str) -> Result<(String, String)> {
Expand Down
17 changes: 9 additions & 8 deletions crates/rwalk/src/wordlist/processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,35 +114,36 @@ impl<'a> WordlistProcessor<'a> {
include_comments: bool,
) -> Result<()> {
debug!("Processing wordlist: {}", path);
let path = PathBuf::from(&*path)

let canonical_path = PathBuf::from(&*path)
.canonicalize()
.map_err(|e| crate::error!("Failed to open wordlist file {}: {}", path.bold(), e))?;

let file = File::open(&*path).await?;
let file = File::open(&canonical_path).await?;
let reader = BufReader::new(file);
let mut lines = reader.lines();

while let Some(line) = lines.next_line().await? {
if !line.trim().is_empty() {
let processed_line = if include_comments {
Some(line)
} else {
Self::strip_comments(&line)
};

if let Some(mut word) = processed_line {
transformer.apply(&mut word);
let word: CowStr = word.into();

if filterer.filter(&(key.clone(), word.clone()))? {
shared_words.entry(key.clone()).or_default().insert(word);
}
}
}
}

Ok(())
}
}

fn create_transformer(&self, wordlist_key: &str) -> Result<Transformer<String>> {
let transformers = self
Expand Down