8000 Merge pull request #964 from tylerchurch/patch-2 · nodegit/nodegit@75b015d · GitHub
[go: up one dir, main page]

Skip to content

Commit 75b015d

Browse files
committed
Merge pull request #964 from tylerchurch/patch-2
diff.blobToBuffer: Fix passing in Buffers instead of strings.
2 parents 487aa31 + a87b573 commit 75b015d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/diff.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ Diff.blobToBuffer= function(
7272
var bufferLength;
7373
if (buffer instanceof Buffer) {
7474
bufferText = buffer.toString("utf8");
75-
bufferLength = buffer.length;
75+
bufferLength = Buffer.byteLength(buffer, "utf8");
7676
} else {
7777
bufferText = buffer;
7878
bufferLength = !buffer ? 0 : Buffer.byteLength(buffer, "utf8");
@@ -84,7 +84,7 @@ Diff.blobToBuffer= function(
8484
this,
8585
old_blob,
8686
old_as_path,
87-
buffer,
87+
bufferText,
8888
bufferLength,
8989
buffer_as_path,
9090
opts,

0 commit comments

Comments
 (0)
0