particle-api-js
Advanced tools
Comparing version 6.6.1 to 6.6.2
# changelog | ||
## 6.6.2 - 15 Sep 2017 | ||
* Fix nested directories bug | ||
## 6.6.1 - 14 Sep 2017 | ||
@@ -4,0 +7,0 @@ * Update form-data to v1.0.0-relativepath.2 |
@@ -237,4 +237,4 @@ 'use strict'; | ||
req._getFormData().append(name, file.data, { | ||
filename: file.path, | ||
relativePath: _path2.default.dirname(file.path) | ||
filename: file.path.replace(/\\/g, '/'), | ||
includePath: true | ||
}); | ||
@@ -241,0 +241,0 @@ } |
@@ -11,6 +11,2 @@ 'use strict'; | ||
var _typeof2 = require('babel-runtime/helpers/typeof'); | ||
var _typeof3 = _interopRequireDefault(_typeof2); | ||
var _promise = require('babel-runtime/core-js/promise'); | ||
@@ -114,29 +110,23 @@ | ||
if (statusCode !== 200) { | ||
var _ret = function () { | ||
var body = ''; | ||
res.on('data', function (chunk) { | ||
return body += chunk; | ||
}); | ||
res.on('end', function () { | ||
try { | ||
body = JSON.parse(body); | ||
} finally { | ||
_this2.emit('response', { | ||
statusCode: statusCode, | ||
body: body | ||
}); | ||
var errorDescription = 'HTTP error ' + statusCode + ' from ' + _this2.uri; | ||
if (body && body.error_description) { | ||
errorDescription += ' - ' + body.error_description; | ||
} | ||
reject({ statusCode: statusCode, errorDescription: errorDescription, body: body }); | ||
_this2.req = undefined; | ||
var body = ''; | ||
res.on('data', function (chunk) { | ||
return body += chunk; | ||
}); | ||
res.on('end', function () { | ||
try { | ||
body = JSON.parse(body); | ||
} finally { | ||
_this2.emit('response', { | ||
statusCode: statusCode, | ||
body: body | ||
}); | ||
var errorDescription = 'HTTP error ' + statusCode + ' from ' + _this2.uri; | ||
if (body && body.error_description) { | ||
errorDescription += ' - ' + body.error_description; | ||
} | ||
}); | ||
return { | ||
v: void 0 | ||
}; | ||
}(); | ||
if ((typeof _ret === 'undefined' ? 'undefined' : (0, _typeof3.default)(_ret)) === "object") return _ret.v; | ||
reject({ statusCode: statusCode, errorDescription: errorDescription, body: body }); | ||
_this2.req = undefined; | ||
} | ||
}); | ||
return; | ||
} | ||
@@ -143,0 +133,0 @@ |
{ | ||
"name": "particle-api-js", | ||
"version": "6.6.1", | ||
"version": "6.6.2", | ||
"description": "Particle API Client", | ||
@@ -78,3 +78,3 @@ "main": "lib/Particle.js", | ||
"babel-runtime": "^6.9.2", | ||
"form-data": "https://github.com/spark/form-data/archive/v1.0.0-relativepath.2.tar.gz", | ||
"form-data": "https://github.com/spark/form-data/archive/v1.0.0-rc4.tar.gz", | ||
"stream-http": "https://github.com/spark/stream-http/archive/v2.2.1.tar.gz", | ||
@@ -81,0 +81,0 @@ "superagent": "^2.2.0", |
@@ -218,4 +218,4 @@ import {sinon, expect} from './test-setup'; | ||
expect(attach.callCount).to.be.equal(2); | ||
expect(attach).to.be.calledWith('file', 'filedata', {filename: 'filepath', relativePath: '.'}); | ||
expect(attach).to.be.calledWith('file2', 'file2data', {filename: 'file2path', relativePath: '.'}); | ||
expect(attach).to.be.calledWith('file', 'filedata', {filename: 'filepath', includePath: true}); | ||
expect(attach).to.be.calledWith('file2', 'file2data', {filename: 'file2path', includePath: true}); | ||
}); | ||
@@ -241,4 +241,4 @@ | ||
expect(attach.callCount).to.be.equal(2); | ||
expect(attach).to.be.calledWith('file', 'filedata', {filename: 'filepath', relativePath: '.'}); | ||
expect(attach).to.be.calledWith('file2', 'file2data', {filename: 'file2path', relativePath: '.'}); | ||
expect(attach).to.be.calledWith('file', 'filedata', {filename: 'filepath', includePath: true}); | ||
expect(attach).to.be.calledWith('file2', 'file2data', {filename: 'file2path', includePath: true}); | ||
expect(field.callCount).to.be.equal(2); | ||
@@ -248,2 +248,15 @@ expect(field).to.be.calledWith('form1', 'value1'); | ||
}); | ||
it('should handle nested dirs', () => { | ||
const sut = new Agent(); | ||
const files = { | ||
file: {data: 'filedata', path: 'filepath.ino'}, | ||
file2: {data: 'file2data', path: 'dir/file2path.cpp'}, | ||
file3: {data: 'file3data', path: 'dir\\windowsfile2path.cpp'} | ||
} | ||
const req = sut._buildRequest({uri: 'uri', method: 'get', files: files}); | ||
expect(req._formData._streams[0]).to.contain('filename="filepath.ino"'); | ||
expect(req._formData._streams[3]).to.contain('filename="dir/file2path.cpp"'); | ||
expect(req._formData._streams[6]).to.contain('filename="dir/windowsfile2path.cpp"'); | ||
}); | ||
}); | ||
@@ -250,0 +263,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
HTTP dependency
Supply chain riskContains a dependency which resolves to a remote HTTP URL which could be used to inject untrusted code and reduce overall package reliability.
Found 1 instance in 1 package
HTTP dependency
Supply chain riskContains a dependency which resolves to a remote HTTP URL which could be used to inject untrusted code and reduce overall package reliability.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance 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
1549234
11390
11
7