Skip to content

Commit f543216

Browse files
committed
Added logic to check whether the parameter is an array or a string.
1 parent 07fe4e8 commit f543216

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/Issue/IssueService.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,10 @@ private function bulkInsert($issues)
127127
*/
128128
public function addAttachments($issueIdOrKey, $filePathArray)
129129
{
130+
if (is_array($filePathArray) == false) {
131+
$filePathArray = [$filePathArray];
132+
}
133+
130134
$results = $this->upload($this->uri."/$issueIdOrKey/attachments", $filePathArray);
131135

132136
$this->log->addInfo('addAttachments result='.var_export($results, true));
@@ -139,6 +143,11 @@ public function addAttachments($issueIdOrKey, $filePathArray)
139143
$ret, new \ArrayObject(), '\JiraRestApi\Issue\Attachment'
140144
)
141145
);
146+
} else {
147+
array_push($resArr, $this->json_mapper->map(
148+
$ret, new Attachment
149+
)
150+
);
142151
}
143152
}
144153

0 commit comments

Comments
 (0)