From 3da996afc7469be7295028113715a5035e47a663 Mon Sep 17 00:00:00 2001 From: ralf Date: Thu, 13 Jul 2023 16:31:48 +0200 Subject: [PATCH] WIP Mail REST API: fix docu and content-type of response for uploading attachments --- doc/REST-CalDAV-CardDAV/Mail.md | 10 ++++++++-- mail/src/ApiHandler.php | 1 + 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/doc/REST-CalDAV-CardDAV/Mail.md b/doc/REST-CalDAV-CardDAV/Mail.md index 760b1c66b1..a21a6ff112 100644 --- a/doc/REST-CalDAV-CardDAV/Mail.md +++ b/doc/REST-CalDAV-CardDAV/Mail.md @@ -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/ --user \ +curl -i https://example.org/egroupware/groupdav.php/mail/attachments/ --user \ --data-binary @ -H 'Content-Type: ' -HTTP/1.1 204 No Content +HTTP/1.1 302 Found Location: https://example.org/egroupware/groupdav.php/mail/attachment/ + +{ + "status": 200, + "message": "Attachment stored", + "location": "/mail/attachments/--xM35lY" +} ``` \ No newline at end of file diff --git a/mail/src/ApiHandler.php b/mail/src/ApiHandler.php index 2b0fa04cb4..99becba286 100644 --- a/mail/src/ApiHandler.php +++ b/mail/src/ApiHandler.php @@ -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',