Skip to content

Commit

Permalink
Added logic to check whether the parameter is an array or a string.
Browse files Browse the repository at this point in the history
  • Loading branch information
lesstif committed Jan 20, 2017
1 parent 07fe4e8 commit f543216
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/Issue/IssueService.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,10 @@ private function bulkInsert($issues)
*/
public function addAttachments($issueIdOrKey, $filePathArray)
{
if (is_array($filePathArray) == false) {
$filePathArray = [$filePathArray];
}

$results = $this->upload($this->uri."/$issueIdOrKey/attachments", $filePathArray);

$this->log->addInfo('addAttachments result='.var_export($results, true));
Expand All @@ -139,6 +143,11 @@ public function addAttachments($issueIdOrKey, $filePathArray)
$ret, new \ArrayObject(), '\JiraRestApi\Issue\Attachment'
)
);
} else {
array_push($resArr, $this->json_mapper->map(
$ret, new Attachment
)
);
}
}

Expand Down

0 comments on commit f543216

Please sign in to comment.