From: Ian Jackson Date: Sun, 8 Aug 2021 01:47:40 +0000 (+0100) Subject: config: bail on same quote in quotes, break out quote var X-Git-Tag: hippotat/1.0.0~227 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ian/git?a=commitdiff_plain;h=91e901daf19c32a5f38169b48a56b595260579d1;p=hippotat.git config: bail on same quote in quotes, break out quote var Signed-off-by: Ian Jackson --- diff --git a/src/config.rs b/src/config.rs index d899348..b439e4a 100644 --- a/src/config.rs +++ b/src/config.rs @@ -281,12 +281,14 @@ impl Aggregate { anyhow!("quoted value contains backslash, not supported") ); } - let unq = raw[1..].strip_suffix(&raw[0..1]) + let quote = &raw[0..1]; + + let unq = raw[1..].strip_suffix(quote) .ok_or_else( || anyhow!("mismatched quotes around quoted value") )? .to_owned(); - if unq.contains(&raw[0..1]) { + if unq.contains(quote) { throw!(anyhow!( "quoted value contains quote (escaping not supported)" ))