Skip to content

Commit 0d0d593

Browse files
committed
backport encodingLength fix to v1
1 parent 7f35bac commit 0d0d593

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

index.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ name.decode = function (buf, offset) {
7474
name.decode.bytes = 0
7575

7676
name.encodingLength = function (n) {
77-
return Buffer.byteLength(n) + 2
77+
if (n === '.') return 1
78+
return Buffer.byteLength(n.replace(/^\.|\.$/gm, '')) + 2
7879
}
7980

8081
var string = {}

0 commit comments

Comments
 (0)