loleaflet/src/control/Control.Menubar.js |    5 ++---
 wsd/LOOLWSD.cpp                          |   12 ++++--------
 2 files changed, 6 insertions(+), 11 deletions(-)

New commits:
commit 25224666a79efd2c700ea5998f9c2683c9eadef9
Author: Jan Holesovsky <[email protected]>
Date:   Wed May 10 15:01:01 2017 +0200

    Revert "Implement File -> Download As -> Plain text (.txt)."
    
    Actually it is enough to do Ctrl-a Ctrl-c, no need to have a special 
Download
    As -> Plain text.
    
    This reverts commit 1c13d5523f71b1b49ae37533d95b507934253baf.

diff --git a/loleaflet/src/control/Control.Menubar.js 
b/loleaflet/src/control/Control.Menubar.js
index d77bd6a8..89048a3b 100644
--- a/loleaflet/src/control/Control.Menubar.js
+++ b/loleaflet/src/control/Control.Menubar.js
@@ -15,8 +15,7 @@ L.Control.Menubar = L.Control.extend({
                                        {name: _('PDF Document (.pdf)'), id: 
'downloadas-pdf', type: 'action'},
                                        {name: _('ODF text document (.odt)'), 
id: 'downloadas-odt', type: 'action'},
                                        {name: _('Microsoft Word 2003 (.doc)'), 
id: 'downloadas-doc', type: 'action'},
-                                       {name: _('Microsoft Word (.docx)'), id: 
'downloadas-docx', type: 'action'},
-                                       {name: _('Plain text (.txt)'), id: 
'downloadas-txt', type: 'action'}]}]
+                                       {name: _('Microsoft Word (.docx)'), id: 
'downloadas-docx', type: 'action'}]}]
                        },
                        {name: _('Edit'), type: 'menu', menu: [
                                {name: _('Repair'), id: 'repair',  type: 
'action'},
@@ -284,7 +283,7 @@ L.Control.Menubar = L.Control.extend({
                allowedReadonlyMenus: ['file', 'downloadas', 'view', 'help'],
 
                allowedViewModeActions: [
-                       'downloadas-pdf', 'downloadas-odt', 'downloadas-doc', 
'downloadas-docx', 'downloadas-txt', // file menu
+                       'downloadas-pdf', 'downloadas-odt', 'downloadas-doc', 
'downloadas-docx', // file menu
                        'downloadas-odp', 'downloadas-ppt', 'downloadas-pptx', 
// file menu
                        'downloadas-ods', 'downloadas-xls', 'downloadas-xlsx', 
// file menu
                        'fullscreen', 'zoomin', 'zoomout', 'zoomreset', // view 
menu
diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp
index ce983651..e1397d92 100644
--- a/wsd/LOOLWSD.cpp
+++ b/wsd/LOOLWSD.cpp
@@ -1800,13 +1800,7 @@ private:
 
     static std::string getContentType(const std::string& fileName)
     {
-        const std::string extension = Poco::Path(fileName).getExtension();
-
-        // TODO discovery.xml missing application/pdf
-        if (extension == "pdf")
-            return "application/pdf";
-
-        const std::string nodePath = Poco::format("//[@ext='%s']", extension);
+        const std::string nodePath = Poco::format("//[@ext='%s']", 
Poco::Path(fileName).getExtension());
         std::string discPath = 
Path(Application::instance().commandPath()).parent().toString() + 
"discovery.xml";
         if (!File(discPath).exists())
         {
@@ -1816,6 +1810,7 @@ private:
         InputSource input(discPath);
         DOMParser domParser;
         AutoPtr<Poco::XML::Document> doc = domParser.parse(&input);
+        // TODO. discovery.xml missing application/pdf
         Node* node = doc->getNodeByPath(nodePath);
         if (node && (node = node->parentNode()) && node->hasAttributes())
         {
@@ -2008,8 +2003,9 @@ private:
             if (filePath.isAbsolute() && File(filePath).exists())
             {
                 std::string contentType = getContentType(fileName);
-                if (contentType == "application/pdf" || contentType == 
"text/plain")
+                if (Poco::Path(fileName).getExtension() == "pdf")
                 {
+                    contentType = "application/pdf";
                     response.set("Content-Disposition", "attachment; 
filename=\"" + fileName + "\"");
                 }
 
_______________________________________________
Libreoffice-commits mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to