From 661adbfbd282568dca144bf7ec39c3fbbda80d90 Mon Sep 17 00:00:00 2001 From: Ruben Beltran del Rio Date: Mon, 27 Jan 2025 22:25:38 +0100 Subject: Escape chars when debugging --- src/middleware/find_mailboxes_compatibility.rs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'src/middleware') diff --git a/src/middleware/find_mailboxes_compatibility.rs b/src/middleware/find_mailboxes_compatibility.rs index 0e4b2cd..ddc12f1 100644 --- a/src/middleware/find_mailboxes_compatibility.rs +++ b/src/middleware/find_mailboxes_compatibility.rs @@ -24,7 +24,11 @@ impl Middleware for FindMailboxesCompatibility { // We'll need to convert the LIST to a FIND self.tags.push(tag.trim().to_string()); let replacement = format!("{} LIST \"\" \"*\"\r\n", tag.trim()); - debug!("### {replacement}"); + let debug_str = replacement + .replace('\n', "\\n") + .replace('\r', "\\r") + .replace('\t', "\\t"); + debug!("### {debug_str}"); return replacement.into_bytes(); } } @@ -63,6 +67,13 @@ impl Middleware for FindMailboxesCompatibility { }) .collect(); - lines.join("\n").into_bytes() + let replacement = lines.join("\n"); + let debug_str = replacement + .replace('\n', "\\n") + .replace('\r', "\\r") + .replace('\t', "\\t"); + debug!("### {debug_str}"); + + replacement.into_bytes() } } -- cgit