Skip to content

Commit

Permalink
Include backslash escape, fix number of backslashes in single quote e…
Browse files Browse the repository at this point in the history
…scape
  • Loading branch information
qilyn committed Nov 26, 2024
1 parent e6c218b commit 65311be
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/briefcase/integrations/cookiecutter.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ def __init__(self, environment):
super().__init__(environment)

def escape_gradle(obj):
"""Escapes single quotes."""
return obj.replace("'", "")
"""Escapes single quotes and backslashes."""
return obj.replace("\\", "\\\\").replace("'", "\\'")

def escape_non_ascii(obj):
"""Quotes obj if non ascii characters are present."""
Expand Down
2 changes: 1 addition & 1 deletion tests/integrations/cookiecutter/test_GradleEscape.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
[
("Hello World", "Hello World"),
("Hello ' World", "Hello \\' World"),
# ("Hello \\ World", "Hello \\\\ World"),
("Hello \\ World", "Hello \\\\ World"),
],
)
def test_escape_gradle(value, expected):
Expand Down

0 comments on commit 65311be

Please sign in to comment.