Skip to content

Commit 3199cd4

Browse files
authored
Merge pull request #106 from bysiber/fix/escape-backslash
Fix escape() not escaping backslash characters
2 parents 84d984c + 7b2b708 commit 3199cd4

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

pathspec/patterns/gitignore/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def escape(s: AnyStr) -> AnyStr:
4747
raise TypeError(f"s:{s!r} is not a unicode or byte string.")
4848

4949
# Reference: https://git-scm.com/docs/gitignore#_pattern_format
50-
out_string = ''.join((f"\\{x}" if x in '[]!*#?' else x) for x in string)
50+
out_string = ''.join((f"\\{x}" if x in '\\[]!*#?' else x) for x in string)
5151

5252
if return_type is bytes:
5353
return out_string.encode(_BYTES_ENCODING)

0 commit comments

Comments
 (0)