notifications-node-client
Advanced tools
Comparing version 5.2.0 to 5.2.1
@@ -0,1 +1,5 @@ | ||
## 5.2.1 - 2022-10-19 | ||
* Support strings in calls to `prepareUpload`. `fs.readFile` can return strings if an encoding is provided, and the client didn't handle these correctly. | ||
## 5.2.0 - 2022-09-27 | ||
@@ -2,0 +6,0 @@ |
@@ -118,2 +118,5 @@ var ApiClient = require('./api_client'); | ||
} | ||
if (typeof(file) === 'string') { | ||
file = Buffer.from(file); | ||
} | ||
return file.toString('base64') | ||
@@ -120,0 +123,0 @@ } |
{ | ||
"name": "notifications-node-client", | ||
"version": "5.2.0", | ||
"version": "5.2.1", | ||
"homepage": "https://docs.notifications.service.gov.uk/node.html", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -191,2 +191,20 @@ const chai = require('chai'); | ||
}); | ||
it('should accept files as buffers (from fs.readFile with no encoding)', () => { | ||
let fs = require('fs'); | ||
let file = fs.readFileSync('./spec/test_files/simple.csv'); | ||
expect(typeof(file)).to.equal('object') | ||
expect(Buffer.isBuffer(file)).to.equal(true); | ||
expect( | ||
notifyClient.prepareUpload(file, true) | ||
).contains({file: 'MSwyLDMKYSxiLGMK', is_csv: true}) | ||
}); | ||
it('should accept files as strings (from fs.readFile with an encoding)', () => { | ||
let fs = require('fs'); | ||
let file = fs.readFileSync('./spec/test_files/simple.csv', 'binary'); | ||
expect(typeof(file)).to.equal('string') | ||
expect(Buffer.isBuffer(file)).to.equal(false); | ||
expect( | ||
notifyClient.prepareUpload(file, true) | ||
).contains({file: 'MSwyLDMKYSxiLGMK', is_csv: true}) | ||
}); | ||
@@ -193,0 +211,0 @@ it('should allow isCsv to be set with the old method (directly into options)', () => { |
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 12 instances in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
235347
42
2084
15