Skip to content

Commit 464fdda

Browse files
lukas-eudroideck
authored andcommitted
Merge commit from fork
1 parent 9f5b2ef commit 464fdda

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

Lib/ldap/filter.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ def escape_filter_chars(assertion_value,escape_mode=0):
2424
If 1 all NON-ASCII chars are escaped.
2525
If 2 all chars are escaped.
2626
"""
27+
if not isinstance(assertion_value, str):
28+
raise TypeError("assertion_value must be of type str.")
2729
if escape_mode:
2830
r = []
2931
if escape_mode==1:

Tests/t_ldap_filter.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ def test_escape_filter_chars_mode1(self):
4949
),
5050
r'\c3\a4\c3\b6\c3\bc\c3\84\c3\96\c3\9c\c3\9f'
5151
)
52+
with self.assertRaises(TypeError):
53+
escape_filter_chars(["abc@*()/xyz"], escape_mode=1)
54+
with self.assertRaises(TypeError):
55+
escape_filter_chars({"abc@*()/xyz": 1}, escape_mode=1)
5256

5357
def test_escape_filter_chars_mode2(self):
5458
"""

0 commit comments

Comments
 (0)