mirror of
https://github.com/SerenityOS/serenity
synced 2024-09-16 06:30:41 +00:00
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.
This commit is contained in:
parent
6c7ee391cb
commit
e371552ff2
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue