Skip to content

Commit 8202863

Browse files
hasezoeygabrielcsapo
authored andcommitted
Fix for #38 (#39)
* gitignore update for visual studio, Buffer Fix #38 * Update util.js * Update service.js
1 parent 415e23d commit 8202863

File tree

12 files changed

+4
-3
lines changed

12 files changed

+4
-3
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ coverage
66
example/test
77
example/tmp
88
package-lock.json
9+
.vs/

lib/service.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class Service extends HttpDuplex {
5050
if(req.headers["authorization"]) {
5151
const tokens = req.headers["authorization"].split(" ");
5252
if (tokens[0] === "Basic") {
53-
const splitHash = new Buffer(tokens[1], 'base64').toString('utf8').split(":");
53+
const splitHash = new Buffer.from(tokens[1], 'base64').toString('utf8').split(":");
5454
this.username = splitHash.shift();
5555
}
5656
}
@@ -116,7 +116,7 @@ class Service extends HttpDuplex {
116116

117117

118118
self.emit('response', respStream, function endResponse() {
119-
res.queue(new Buffer('0000'));
119+
res.queue(new Buffer.from('0000'));
120120
res.queue(null);
121121
});
122122
ps.stdout.pipe(respStream).pipe(res);

lib/util.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const Util = {
3434
} else {
3535
const tokens = req.headers["authorization"].split(" ");
3636
if (tokens[0] === "Basic") {
37-
const splitHash = new Buffer(tokens[1], 'base64').toString('utf8').split(":");
37+
const splitHash = new Buffer.from(tokens[1], 'base64').toString('utf8').split(":");
3838
const username = splitHash.shift();
3939
const password = splitHash.join(":");
4040
callback(username, password, null);

test/fixtures/server/tmp/test.git/hooks/applypatch-msg.sample

100755100644
File mode changed.

test/fixtures/server/tmp/test.git/hooks/commit-msg.sample

100755100644
File mode changed.

test/fixtures/server/tmp/test.git/hooks/post-update.sample

100755100644
File mode changed.

test/fixtures/server/tmp/test.git/hooks/pre-applypatch.sample

100755100644
File mode changed.

test/fixtures/server/tmp/test.git/hooks/pre-commit.sample

100755100644
File mode changed.

test/fixtures/server/tmp/test.git/hooks/pre-push.sample

100755100644
File mode changed.

test/fixtures/server/tmp/test.git/hooks/pre-rebase.sample

100755100644
File mode changed.

0 commit comments

Comments
 (0)