[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-2-0' - wsd/LOOLWSD.cpp
Pranav Kant
pranavk at collabora.co.uk
Wed Dec 14 09:23:35 UTC 2016
wsd/LOOLWSD.cpp | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
New commits:
commit 55ab97121c77871dcc95033802d6606a7bdae555
Author: Pranav Kant <pranavk at 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.timar at 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)
More information about the Libreoffice-commits
mailing list