diff --git a/src/lib.rs b/src/lib.rs index 52da4d7..64cb64c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -48,8 +48,8 @@ impl Config { .filter(|l| !l.is_empty()) .filter(|l| !l.starts_with('#')) { - if line.starts_with('[') && line.ends_with(']') { - current_section = line[1..line.len() - 1].to_string(); + if line.starts_with('[') && line.contains(']') { + current_section = line[1..line.find(']').unwrap()].to_string(); } else if let Some((key, value)) = line.split_once('=') { let key_trimmed_string = key.trim().replace('"', ""); let key_trimmed = key_trimmed_string.as_str();