Skip to content

Commit

Permalink
Merge pull request #48 from jordonbiondo/feature/fix-buffer-vulnerabi…
Browse files Browse the repository at this point in the history
…lities

fix buffer vulnerabilities
  • Loading branch information
gabegorelick authored Sep 30, 2019
2 parents dbe6c23 + 08f3c73 commit 490b3ef
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lib/compile.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ module.exports = function (options) {

var compiler = new Compiler(options);
var contents = compiler.convertPo([file.contents.toString()]);
file.contents = new Buffer(contents);
file.contents = Buffer.from(contents);

var dirname = path.dirname(file.path);
var basename = path.basename(file.path, '.po');
Expand Down
4 changes: 2 additions & 2 deletions lib/extract.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ module.exports = function (out, config) {
}

extractor.parse(file.relative, file.contents.toString());
file.contents = new Buffer(extractor.toString());
file.contents = Buffer.from(extractor.toString());

var extension = path.extname(file.path);
var extIndex = file.path.lastIndexOf(extension);
Expand Down Expand Up @@ -79,7 +79,7 @@ module.exports = function (out, config) {
cwd: firstFile.cwd,
base: firstFile.base,
path: path.join(firstFile.base, out),
contents: new Buffer(extractor.toString())
contents: Buffer.from(extractor.toString())
}));

cb();
Expand Down
6 changes: 3 additions & 3 deletions test/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ var createFixtureFile = function (filename, content) {
cwd: __dirname,
base: fixturesDir,
path: path.join(fixturesDir, filename),
contents: new Buffer(content)
contents: Buffer.from(content)
});
};

Expand Down Expand Up @@ -166,13 +166,13 @@ describe('gulp-angular-gettext', function () {
cwd: __dirname,
base: anotherDir,
path: path.join(fixturesDir, 'partial1.html'),
contents: new Buffer('<div translate>Hello</div>')
contents: Buffer.from('<div translate>Hello</div>')
});
var partial2 = new Vinyl({
cwd: __dirname,
base: anotherDir,
path: path.join(fixturesDir, 'partial2.html'),
contents: new Buffer('<div translate>world</div>')
contents: Buffer.from('<div translate>world</div>')
});

var stream = extract('out.pot');
Expand Down

0 comments on commit 490b3ef

Please sign in to comment.