wsd/LOOLWSD.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
New commits: commit 55ab97121c77871dcc95033802d6606a7bdae555 Author: Pranav Kant <pran...@collabora.co.uk> Date: Tue Dec 13 19:38:05 2016 +0530 tdf#104157: Fix Content-Type and add Content-Disposition for pdf Change-Id: I07a02a621f0f067b9810d0f92bd3b9fff112af54 (cherry picked from commit 49193b3f5820bc7103b89aa24fabb1c2c69e6804) Signed-off-by: Andras Timar <andras.ti...@collabora.com> diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp index 16802e1..9b86333 100644 --- a/wsd/LOOLWSD.cpp +++ b/wsd/LOOLWSD.cpp @@ -712,10 +712,17 @@ private: LOG_INF("HTTP request for: " << filePath.toString()); if (filePath.isAbsolute() && File(filePath).exists()) { + std::string contentType = getContentType(fileName); response.set("Access-Control-Allow-Origin", "*"); + if (Poco::Path(fileName).getExtension() == "pdf") + { + contentType = "application/pdf"; + response.set("Content-Disposition", "attachment; filename=\"" + fileName + "\""); + } + try { - response.sendFile(filePath.toString(), getContentType(fileName)); + response.sendFile(filePath.toString(), contentType); responded = true; } catch (const Exception& exc) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits