wsd/LOOLWSD.cpp |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

New commits:
commit 02dbc826318fef5056236d649c6bb6cdb766c03f
Author: Jan Holesovsky <ke...@collabora.com>
Date:   Wed May 17 16:28:55 2017 +0200

    wsd: Don't set Content-Disposition for SVGs, the browser must handle them.
    
    Otherwise the presesntation mode downloads them instead of showing.
    
    Change-Id: If2c9785aa5ef6bbb65e911b834c77ea83da281e7
    Reviewed-on: https://gerrit.libreoffice.org/37716
    Reviewed-by: Jan Holesovsky <ke...@collabora.com>
    Tested-by: Jan Holesovsky <ke...@collabora.com>

diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp
index 40fd9066..1c6c91d6 100644
--- a/wsd/LOOLWSD.cpp
+++ b/wsd/LOOLWSD.cpp
@@ -2009,10 +2009,15 @@ private:
             if (filePath.isAbsolute() && File(filePath).exists())
             {
                 // Instruct browsers to download the file, not display it
-                response.set("Content-Disposition", "attachment; filename=\"" 
+ fileName + "\"");
+                // with the exception of SVG where we need the browser to
+                // actually show it.
+                std::string contentType = getContentType(fileName);
+                if (contentType != "image/svg+xml")
+                    response.set("Content-Disposition", "attachment; 
filename=\"" + fileName + "\"");
+
                 try
                 {
-                    HttpHelper::sendFile(socket, filePath.toString(), 
getContentType(fileName), response);
+                    HttpHelper::sendFile(socket, filePath.toString(), 
contentType, response);
                     responded = true;
                 }
                 catch (const Exception& exc)
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to