configure.ac    |    2 +-
 wsd/LOOLWSD.cpp |   51 +++++++++------------------------------------------
 2 files changed, 10 insertions(+), 43 deletions(-)

New commits:
commit b811f70492922ade05b1d0a30c71a7be22084c19
Author:     Tor Lillqvist <t...@collabora.com>
AuthorDate: Wed Aug 15 11:01:05 2018 +0300
Commit:     Tor Lillqvist <t...@collabora.com>
CommitDate: Wed Aug 15 11:36:20 2018 +0300

    Revert "When asked to convert to PNG, look for an embedded ODF thumbnail 
first"
    
    The embedded ODF thumbnail in documents produced by OOo or LO is too
    small (max 256 pixels) to be useful in general, so let's not bother.
    
    This reverts commit 3a9e536dfab71f6999a39d7371a9dd8844815ae7.
    
    Change-Id: I503b61f85264b9be658064632ffd1f94518b2a3c

diff --git a/configure.ac b/configure.ac
index 823378d6e..421fdd686 100644
--- a/configure.ac
+++ b/configure.ac
@@ -332,7 +332,7 @@ else
 fi
 AC_SUBST(ENABLE_SUPPORT_KEY)
 
-LIBS="$LIBS -lPocoNet${POCO_DEBUG_SUFFIX} -lPocoUtil${POCO_DEBUG_SUFFIX} 
-lPocoJSON${POCO_DEBUG_SUFFIX} -lPocoFoundation${POCO_DEBUG_SUFFIX} 
-lPocoXML${POCO_DEBUG_SUFFIX} -lPocoNetSSL${POCO_DEBUG_SUFFIX} 
-lPocoCrypto${POCO_DEBUG_SUFFIX} -lPocoZip${POCO_DEBUG_SUFFIX}"
+LIBS="$LIBS -lPocoNet${POCO_DEBUG_SUFFIX} -lPocoUtil${POCO_DEBUG_SUFFIX} 
-lPocoJSON${POCO_DEBUG_SUFFIX} -lPocoFoundation${POCO_DEBUG_SUFFIX} 
-lPocoXML${POCO_DEBUG_SUFFIX} -lPocoNetSSL${POCO_DEBUG_SUFFIX} 
-lPocoCrypto${POCO_DEBUG_SUFFIX}"
 
 AC_CHECK_HEADERS([LibreOfficeKit/LibreOfficeKit.h],
                  [],
diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp
index fc1f83013..ae32cfb18 100644
--- a/wsd/LOOLWSD.cpp
+++ b/wsd/LOOLWSD.cpp
@@ -91,8 +91,6 @@
 #include <Poco/Util/OptionSet.h>
 #include <Poco/Util/ServerApplication.h>
 #include <Poco/Util/XMLConfiguration.h>
-#include <Poco/Zip/ZipArchive.h>
-#include <Poco/Zip/ZipStream.h>
 
 #include "Admin.hpp"
 #include "Auth.hpp"
@@ -2065,49 +2063,18 @@ private:
                 std::string thumbnailFile;
                 if (format == "png")
                 {
+                    // Check whether we already have a cached "thumbnail" for 
this document.
+
+                    // NOTE: We do *not* want to simply extract the embedded
+                    // Thumbnails/thumbnail.png from an ODF document, as that 
is typically too small
+                    // for many purposes (side is max 256 pixels in documents 
generated by
+                    // LibreOffice or its predecessor), and there is no way to 
pass in a requested
+                    // minimum pixel size of the result so we can't know 
whether the actual size of
+                    // the embedded thumbail is big enough.
+
                     std::ifstream istr(fromPath, std::ios::binary);
                     if (istr.is_open() && istr.good())
                     {
-                        // Check whether it is an ODF document with an 
embedded PNG thumbnail.
-
-                        try
-                        {
-                            Poco::Zip::ZipArchive zip(istr);
-                            auto thumbnailHeader = 
zip.findHeader("Thumbnails/thumbnail.png");
-                            if (thumbnailHeader != zip.headerEnd() && 
thumbnailHeader->second.isFile())
-                            {
-                                Poco::Zip::ZipStreamBuf 
thumbnailStreamBuf(istr, thumbnailHeader->second, true);
-                                std::istream 
thumbnailStream(&thumbnailStreamBuf);
-                                if (thumbnailStream.good())
-                                {
-                                    std::string png;
-                                    
Poco::StreamCopier::copyToString(thumbnailStream, png);
-                                    if (!thumbnailStream.bad())
-                                    {
-                                        LOG_TRC("Extracted thumbnail from ODF 
document");
-
-                                        response.set("Content-Disposition", 
"attachment; filename=\"thumbnail.png\"");
-                                        response.setContentType("image/png");
-                                        response.setContentLength(png.size());
-                                        socket->send(response);
-                                        socket->send(png.data(), png.size(), 
true);
-
-                                        return;
-                                    }
-                                }
-                            }
-                        }
-                        catch (Poco::Exception&)
-                        {
-                        }
-
-                        // Close and re-open istr after the Zip stuff above to 
get it into a known
-                        // good state.
-                        istr.close();
-                        istr.open(fromPath, std::ios::binary);
-
-                        // Look for cached thumbnail.
-
                         Poco::SHA1Engine sha1;
                         Poco::DigestOutputStream dos(sha1);
                         Poco::StreamCopier::copyStream(istr, dos);
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to