Skip to content

Commit

Permalink
Merge pull request beeware#1811 from mas192/main
Browse files Browse the repository at this point in the history
issue1746- fixed the toml escape
  • Loading branch information
freakboy3742 authored May 20, 2024
2 parents 3f321b9 + a8c3432 commit 3da7458
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions changes/1746.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Escaping of quotation marks in TOML templates was corrected.
2 changes: 1 addition & 1 deletion src/briefcase/integrations/cookiecutter.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def __init__(self, environment):

def escape_toml(obj):
"""Escapes double quotes and backslashes."""
return obj.replace('"', '"').replace("\\", "\\\\")
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_TOMLEscape.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
[
# Single digit minor
("Hello World", "Hello World"),
('Hello " World', 'Hello " World'),
('Hello " World', 'Hello \\" World'),
("Hello \\ World", "Hello \\\\ World"),
],
)
Expand Down

0 comments on commit 3da7458

Please sign in to comment.