We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
use kdl::{KdlDocument, KdlEntry, KdlNode, KdlValue}; use std::str::FromStr; fn main() { let mut node = KdlNode::new("what"); node.entries_mut().push(KdlEntry::new(KdlValue::RawString( "\"#\nkdl-injection \"no way!!\"//".into(), ))); let mut doc = KdlDocument::new(); doc.nodes_mut().push(node); println!("{doc}"); println!( "{} ≠ {} ‽", doc.nodes().len(), // unparse and parse the document KdlDocument::from_str(&doc.to_string()) .unwrap() .nodes() .len() ); }
outputs
what r#""# kdl-injection "no way!!"//"# 1 ≠ 2 ‽
this is because the implementation of write_raw_string checks for sequences of /#{n}"/ instead of /"#{n}/
write_raw_string
/#{n}"/
/"#{n}/
i'd suggest replacing the for loop with something like
for char in raw.chars() { if char == '"' { consecutive = 1; } else if char == '#' && consecutive > 0 { consecutive += 1; } else { consecutive = 0; } maxhash = maxhash.max(consecutive); }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
outputs
this is because the implementation of
write_raw_string
checks for sequences of/#{n}"/
instead of/"#{n}/
i'd suggest replacing the for loop with something like
The text was updated successfully, but these errors were encountered: