mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-26 09:30:24 +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
Notes:
sideshowbarker
2024-07-17 09:40:41 +09:00
Author: https://github.com/Dexesttp Commit: https://github.com/SerenityOS/serenity/commit/e371552ff2 Pull-request: https://github.com/SerenityOS/serenity/pull/14497 Reviewed-by: https://github.com/linusg ✅
1 changed files with 1 additions and 1 deletions
|
@ -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