From a59598050d378f599c989bee34e79b2bf8cb1c8f Mon Sep 17 00:00:00 2001 From: Jan Holesovsky Date: Wed, 2 Aug 2017 18:55:43 +0200 Subject: [PATCH] convert-to: Set the mimetype in the responses. Change-Id: Ib8dcad5f81499aec0ba147a3a4ef0b7a30995bcc --- wsd/ClientSession.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/wsd/ClientSession.cpp b/wsd/ClientSession.cpp index 5cdcaaf31..d4793e964 100644 --- a/wsd/ClientSession.cpp +++ b/wsd/ClientSession.cpp @@ -638,7 +638,12 @@ bool ClientSession::handleKitToClientMessage(const char* buffer, const int lengt std::string encodedFilePath; Poco::URI::encode(resultURL.getPath(), "", encodedFilePath); LOG_TRC("Sending file: " << encodedFilePath); + + const std::string fileName = Poco::Path(resultURL.getPath()).getFileName(); Poco::Net::HTTPResponse response; + if (!fileName.empty()) + response.set("Content-Disposition", "attachment; filename=\"" + fileName + "\""); + HttpHelper::sendFile(_saveAsSocket, encodedFilePath, mimeType, response); }