mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-10 13:00:29 +03: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 ✅
@ -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 New Issue
Block a user