mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-06 08:36:15 +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:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user