Skip to content
This repository was archived by the owner on May 14, 2024. It is now read-only.

Commit 4cbc51a

Browse files
authored
Merge pull request #3 from ldapjs/issue-2
Allow single character attribute names
2 parents ec0d3f2 + 045bcb9 commit 4cbc51a

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

lib/messages/search-request.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const isValidAttributeString = str => {
3434
return true
3535
}
3636
// ascii attribute names
37-
if (/^[a-zA-Z][\w\d.;-]+$/.test(str) === true) {
37+
if (/^[a-zA-Z][\w\d.;-]*$/.test(str) === true) {
3838
return true
3939
}
4040
return false

lib/messages/search-request.test.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,13 @@ tap.test('.attributes', t => {
100100
)
101101
})
102102

103+
t.test('supports single character names (issue #2)', async t => {
104+
const req = new SearchRequest({
105+
attributes: ['a']
106+
})
107+
t.strictSame(req.attributes, ['a'])
108+
})
109+
103110
t.end()
104111
})
105112

0 commit comments

Comments
 (0)