Skip to content

Commit fbf2af0

Browse files
author
root
committed
Version 8.0.1-v2.1-24.2.00.00 release
1 parent 0d2d64d commit fbf2af0

File tree

6 files changed

+32
-11
lines changed

6 files changed

+32
-11
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
See [DocuSign Support Center](https://support.docusign.com/en/releasenotes/) for Product Release Notes.
33

44

5+
## [v8.0.1] - eSignature API v2.1-24.2.00.00 - 2024-08-22
6+
### Changed
7+
- Fixed issue with document downloads when `Content-Transfer-Encoding` is set to `base64`.
8+
- Updated the SDK release version.
9+
510
## [v8.0.0] - eSignature API v2.1-24.2.00.00 - 2024-07-25
611
### Breaking Changes
712

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ This client SDK is provided as open source, which enables you to customize its f
3232
<a id="versionInformation"></a>
3333
### Version Information
3434
- **API version**: v2.1
35-
- **Latest SDK version**: 8.0.0
35+
- **Latest SDK version**: 8.0.1
3636

3737
<a id="requirements"></a>
3838
## Requirements

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "docusign-esign",
3-
"version": "8.0.0",
3+
"version": "8.0.1",
44
"description": "Docusign Node.js API client.",
55
"license": "MIT",
66
"main": "src/index.js",

src/ApiClient.js

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@
185185
this.defaultHeaders = {
186186
"X-DocuSign-SDK": "Node",
187187
"Node-Ver": process.version,
188-
"User-Agent": `Swagger-Codegen/v2.1/8.0.0/node/${process.version}`,
188+
"User-Agent": `Swagger-Codegen/v2.1/8.0.1/node/${process.version}`,
189189
};
190190

191191
opts = {...defaults, ...opts};
@@ -704,13 +704,19 @@
704704
request
705705
.then((response) => {
706706
try {
707-
const streamData = [];
707+
let streamData = [];
708708
if (requestConfig.headers["Accept"] === "application/pdf") {
709709
response.data.on("data", (chunk) => {
710-
streamData.push(chunk);
710+
streamData.push(requestConfig.headers["Content-Transfer-Encoding"] === "base64" ? chunk.toString() : chunk);
711711
});
712712
response.data.on("end", () => {
713-
resolve(Buffer.concat(streamData));
713+
let res = '';
714+
if(!!streamData.length && streamData[0] instanceof Uint8Array) {
715+
res = Buffer.concat(streamData);
716+
} else {
717+
res = streamData.join('');
718+
}
719+
resolve(res);
714720
});
715721
} else {
716722
data = _this.deserialize(response, returnType);
@@ -728,13 +734,19 @@
728734
request
729735
.then((response) => {
730736
try {
731-
const streamData = [];
737+
let streamData = [];
732738
if (requestConfig.headers["Accept"] === "application/pdf") {
733739
response.data.on("data", (chunk) => {
734-
streamData.push(chunk);
740+
streamData.push(requestConfig.headers["Content-Transfer-Encoding"] === "base64" ? chunk.toString() : chunk);
735741
});
736742
response.data.on("end", () => {
737-
callback(null, Buffer.concat(streamData), response);
743+
let res = '';
744+
if(!!streamData.length && streamData[0] instanceof Uint8Array) {
745+
res = Buffer.concat(streamData);
746+
} else {
747+
res = streamData.join('');
748+
}
749+
callback(null, res, response);
738750
});
739751
} else {
740752
data = _this.deserialize(response, returnType);

test/SdkUnitTests.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -733,15 +733,17 @@ describe('SDK Unit Tests:', function (done) {
733733
.then(function (envelopeSummary) {
734734
if (envelopeSummary) {
735735
console.log('EnvelopeSummary: ' + JSON.stringify(envelopeSummary));
736+
apiClient.addDefaultHeader('Content-Transfer-Encoding', 'base64');
736737
envelopesApi.getDocument(accountId, envelopeSummary.envelopeId, 'combined')
737738
.then(function (pdfBytes) {
739+
apiClient.addDefaultHeader('Content-Transfer-Encoding', undefined);
738740
if (pdfBytes) {
739741
try {
740742
var fs = require('fs');
741743
// download the document pdf
742744
var filename = accountId + '_' + envelopeSummary.envelopeId + '_combined.pdf';
743745
var tempFile = path.resolve(__dirname, filename);
744-
fs.writeFile(tempFile, Buffer.from(pdfBytes, 'binary'), function (err) {
746+
fs.writeFile(tempFile, pdfBytes, 'base64', function (err) {
745747
if (err) console.log('Error: ' + err);
746748
ValidatePdf(tempFile).then(() => {
747749
done();

test/SdkUnitTestsWithCallback.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,9 @@ describe('SDK Unit Tests With Callbacks:', function (done) {
589589

590590
if (envelopeSummary) {
591591
console.log('EnvelopeSummary: ' + JSON.stringify(envelopeSummary));
592+
apiClient.addDefaultHeader('Content-Transfer-Encoding', 'base64');
592593
envelopesApi.getDocument(accountId, envelopeSummary.envelopeId, 'combined', function (err, pdfBytes, response) {
594+
apiClient.addDefaultHeader('Content-Transfer-Encoding', undefined);
593595
if (err) {
594596
return done(err);
595597
}
@@ -600,7 +602,7 @@ describe('SDK Unit Tests With Callbacks:', function (done) {
600602
// download the document pdf
601603
var filename = accountId + '_' + envelopeSummary.envelopeId + '_combined.pdf';
602604
var tempFile = path.resolve(__dirname, filename);
603-
fs.writeFile(tempFile, Buffer.from(pdfBytes, 'binary'), function (err) {
605+
fs.writeFile(tempFile, pdfBytes, 'base64', function (err) {
604606
if (err) console.log('Error: ' + err);
605607
ValidatePdf(tempFile).then(() => {
606608
done();

0 commit comments

Comments
 (0)