Skip to content

Commit

Permalink
Fix slash escaping in multiline annos (#846)
Browse files Browse the repository at this point in the history
  • Loading branch information
Allon-Guralnek committed Aug 9, 2023
1 parent 8b78c76 commit 5d434ca
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion ts/src/model/model.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ describe("Roundtrip", () => {
`),
StringAnnoEscaped: realign(`
App:
@name = "a \\"value\\""
@name = "hello;,?:@&=+$.!~*'()\\"/\\\\ world"
`),
MultilineAnno: realign(`
App:
Expand All @@ -298,6 +298,7 @@ describe("Roundtrip", () => {
| across
|
| multiple lines
| with special chars: hello;,?:@&=+$.!~*'()"/\\ world
`),
ArrayAnno: realign(`
App:
Expand Down
2 changes: 1 addition & 1 deletion ts/src/pbModel/attribute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export class PbAttribute {
* character. Therefore we re-esacpe the backslashes to avoid accidentally escaping something else with them.
*/
static deserializeString(input?: string): string | undefined {
return input?.replaceAll("\\", "\\\\");
return input?.includes("\n") ? input : input?.replaceAll("\\", "\\\\");
}

getAnnoValue(): AnnoValue {
Expand Down

0 comments on commit 5d434ca

Please sign in to comment.