File tree 2 files changed +3
-1
lines changed 2 files changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,8 @@ class PBXGenericObject(object):
10
10
Generic class that creates internal attributes to match the structure of the tree used to create the element.
11
11
Also, prints itself using the openstep format. Extensions might be required to insert comments on right places.
12
12
"""
13
- _VALID_KEY_REGEX = re .compile (r'^[a-zA-Z0-9\\._/]*$' )
13
+ # use negative look-ahead to avoid matching the newline character in multiline strings
14
+ _VALID_KEY_REGEX = re .compile (r'^[a-zA-Z0-9\\._/]*(?!\n)$' )
14
15
_ESCAPE_REPLACEMENTS = [
15
16
('\\ ' , '\\ \\ ' ),
16
17
('\n ' , '\\ n' ),
Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ def testParseKey(self):
27
27
28
28
def testEscapeItem (self ):
29
29
assert PBXGenericObject ._escape ("/bin/sh" ) == "/bin/sh"
30
+ assert PBXGenericObject ._escape ("/bin/sh\n " ) == '"/bin/sh\\ n"'
30
31
assert PBXGenericObject ._escape ("abcdefghijklmnopqrstuvwyz0123456789" ) == \
31
32
"abcdefghijklmnopqrstuvwyz0123456789"
32
33
assert PBXGenericObject ._escape ("some spaces" ) == '"some spaces"'
You can’t perform that action at this time.
0 commit comments