Skip to content

Commit

Permalink
backport encodingLength fix to v1
Browse files Browse the repository at this point in the history
  • Loading branch information
mafintosh committed May 25, 2021
1 parent 7f35bac commit 0d0d593
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ name.decode = function (buf, offset) {
name.decode.bytes = 0

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

var string = {}
Expand Down

0 comments on commit 0d0d593

Please # to comment.