Skip to content

Commit a3a7a58

Browse files
authored
Delete attachments, curl fix (#254)
* Add Attachment DELETE functionality * Add Wiki Attachments/File Uploads support * Add Attachment DELETE functionality * Add Wiki Attachments/File Uploads support * Fix Fatal error: Uncaught Exception: HTTP/2 stream 0 was not closed cleanly * #sync fork changes with original master * #253 Uncaught Exception: HTTP/2 stream 0 was not closed cleanly
1 parent 3c0c5c9 commit a3a7a58

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

src/Redmine/Api/Attachment.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,18 @@ public function upload($attachment, $params = [])
5353
{
5454
return $this->post('/uploads.json?'.http_build_query($params), $attachment);
5555
}
56+
57+
/**
58+
* Delete an attachment
59+
*
60+
* @see https://www.redmine.org/projects/redmine/wiki/Rest_Attachments#DELETE
61+
*
62+
* @param int $id id of the attachment
63+
*
64+
* @return false|\SimpleXMLElement|string
65+
*/
66+
public function remove($id)
67+
{
68+
return $this->delete('/attachments/'.$id.'.xml');
69+
}
5670
}

src/Redmine/Client.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -688,6 +688,9 @@ protected function runRequest($path, $method = 'GET', $data = '')
688688
{
689689
$curl = $this->prepareRequest($path, $method, $data);
690690

691+
// use HTTP 1.1
692+
curl_setopt($curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
693+
691694
$response = curl_exec($curl);
692695
$this->responseCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
693696
$contentType = curl_getinfo($curl, CURLINFO_CONTENT_TYPE);

0 commit comments

Comments
 (0)