fix: escape backslashes in debug locations for HTMLData serialization (#4116)
This commit is contained in:
1 file changed
+9
-1
@@ -346,7 +346,15 @@ impl HTMLData {
|
||||
let body = list
|
||||
.iter()
|
||||
.map(|s| match s {
|
||||
Some(s) => format!(r#""{s}""#),
|
||||
Some(s) => {
|
||||
// Escape backslashes, quotes, and newlines
|
||||
let escaped = s
|
||||
.replace(r#"\"#, r#"\\"#)
|
||||
.replace("\n", r#"\n"#)
|
||||
.replace(r#"""#, r#"\""#);
|
||||
|
||||
format!(r#""{escaped}""#)
|
||||
}
|
||||
None => r#""unknown""#.to_string(),
|
||||
})
|
||||
.collect::<Vec<_>>()
|
||||
|
||||
Reference in new issue
Block a user