WIP Mail REST API: fix docu and content-type of response for uploading attachments

This commit is contained in:
ralf 2023-07-13 16:31:48 +02:00
parent e4b128408f
commit 1bfdb71654
2 changed files with 9 additions and 2 deletions

View File

@ -122,9 +122,15 @@ The content of the POST request is the attachment, a Location header in the resp
to use in further requests, instead of the attachment.
```
curl -i https://example.org/egroupware/groupdav.php/mail/attachment/<filename> --user <user> \
curl -i https://example.org/egroupware/groupdav.php/mail/attachments/<filename> --user <user> \
--data-binary @<file> -H 'Content-Type: <content-type-of-file>'
HTTP/1.1 204 No Content
HTTP/1.1 302 Found
Location: https://example.org/egroupware/groupdav.php/mail/attachment/<token>
{
"status": 200,
"message": "Attachment stored",
"location": "/mail/attachments/<filename>--xM35lY"
}
```
</details>

View File

@ -165,6 +165,7 @@ class ApiHandler extends Api\CalDAV\Handler
{
if (isset($fp)) fclose($fp);
header('Location: '.($location = '/mail/attachments/'.substr(basename($attachment_path), 8)));
header('Content-Type: application/json');
echo json_encode([
'status' => 200,
'message' => 'Attachment stored',