From b5af73daea747adafa2482353563e11d2af45d49 Mon Sep 17 00:00:00 2001 From: ivan baktsheev Date: Sat, 1 Aug 2015 12:56:40 +0300 Subject: [PATCH 1/2] now can upload multiple attachments at once --- api/issue.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/api/issue.js b/api/issue.js index 16fa6167..57b77f84 100644 --- a/api/issue.js +++ b/api/issue.js @@ -853,7 +853,9 @@ function IssueClient(jiraClient) { } var options = this.buildRequestOptions(opts, '/attachments', 'POST'); delete options.body; - options.formData = {file: fs.createReadStream(opts.filename)}; + if (opts.filename.constructor !== Array) opts.filename = [opts.filename]; + var attachments = opts.filename.map (function (filename) {return fs.createReadStream(filename)}); + options.formData = {file: attachments}; options.headers = { "X-Atlassian-Token": "nocheck" }; From 644bd4ef84439374d2da0187bc0d8b04a68d89d9 Mon Sep 17 00:00:00 2001 From: ivan baktsheev Date: Sun, 2 Aug 2015 01:42:00 +0300 Subject: [PATCH 2/2] added note about multiple attachments --- api/issue.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/issue.js b/api/issue.js index 57b77f84..da9fd8ed 100644 --- a/api/issue.js +++ b/api/issue.js @@ -836,7 +836,7 @@ function IssueClient(jiraClient) { }; /** - * Add an attachment to an issue. + * Add an attachments to an issue. * * @method addAttachment * @memberOf IssueClient.js @@ -844,7 +844,7 @@ function IssueClient(jiraClient) { * issueKey property; issueId will be used over issueKey if both are present. * @param {string} [opts.issueId] The id of the issue. EX: 10002 * @param {string} [opts.issueKey] The Key of the issue. EX: JWR-3 - * @param {string} opts.filename The file name of attachment. + * @param {string} opts.filename The file name of attachment. If you pass an array of filenames, multiple attachments will be added. * @param callback Called when the attachment has been attached. */ this.addAttachment = function (opts, callback) {