From e371552ff2d2cf3aabf65decc777dab3c34045b5 Mon Sep 17 00:00:00 2001 From: DexesTTP Date: Tue, 5 Jul 2022 22:48:55 +0200 Subject: [PATCH] LibIMAP: Properly escape the whole string instead of the first character These were obvious wrong uses of the old default "only first occurence" parameter that was used in String::replace. --- Userland/Libraries/LibIMAP/Objects.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Userland/Libraries/LibIMAP/Objects.cpp b/Userland/Libraries/LibIMAP/Objects.cpp index 23dbdf5e83..97710a54a9 100644 --- a/Userland/Libraries/LibIMAP/Objects.cpp +++ b/Userland/Libraries/LibIMAP/Objects.cpp @@ -128,7 +128,7 @@ String serialize_astring(StringView string) // Try to quote auto can_be_quoted = !(string.contains('\n') || string.contains('\r')); if (can_be_quoted) { - auto escaped_str = string.replace("\\", "\\\\", ReplaceMode::FirstOnly).replace("\"", "\\\"", ReplaceMode::FirstOnly); + auto escaped_str = string.replace("\\", "\\\\", ReplaceMode::All).replace("\"", "\\\"", ReplaceMode::All); return String::formatted("\"{}\"", escaped_str); }