Skip to content

Commit ef5d449

Browse files
committed
fix dart
1 parent 50c7333 commit ef5d449

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

generators/src/main/java/com/algolia/codegen/cts/lambda/EscapeSlashLambda.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ public class EscapeSlashLambda implements Mustache.Lambda {
1010
@Override
1111
public void execute(Template.Fragment fragment, Writer writer) throws IOException {
1212
String text = fragment.execute();
13-
writer.write(text.replace("\\", "\\\\"));
13+
// replace all backslashes with double backslashes, unless they are followed by a $
14+
writer.write(text.replaceAll("\\\\(?!\\$)", "\\\\\\\\"));
1415
}
1516
}

0 commit comments

Comments
 (0)