[libreoffice/f20] fix detection of salesforce html

Caolán McNamara caolanm at fedoraproject.org
Tue Jul 1 11:52:31 UTC 2014


commit 3ed83223f80d582c36b00a4cd6b6ee3c02ff2b1b
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Jul 1 12:52:19 2014 +0100

    fix detection of salesforce html

 0001-fix-detection-of-Salesforce-html.patch |   43 +++++++++++++++++++++++++++
 libreoffice.spec                            |    7 ++++-
 2 files changed, 49 insertions(+), 1 deletions(-)
---
diff --git a/0001-fix-detection-of-Salesforce-html.patch b/0001-fix-detection-of-Salesforce-html.patch
new file mode 100644
index 0000000..727ae12
--- /dev/null
+++ b/0001-fix-detection-of-Salesforce-html.patch
@@ -0,0 +1,43 @@
+From a57ac68e18925dfad1377e8bb40a5f74988ade97 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm at redhat.com>
+Date: Tue, 1 Jul 2014 12:50:45 +0100
+Subject: [PATCH] fix detection of Salesforce html
+
+Change-Id: Ie777c253e221527cba8affaf766e2eddfc78c103
+---
+ svtools/source/svhtml/parhtml.cxx | 12 ++++++++++--
+ 1 file changed, 10 insertions(+), 2 deletions(-)
+
+diff --git a/svtools/source/svhtml/parhtml.cxx b/svtools/source/svhtml/parhtml.cxx
+index 54c1548..13a56c3 100644
+--- a/svtools/source/svhtml/parhtml.cxx
++++ b/svtools/source/svhtml/parhtml.cxx
+@@ -1925,6 +1925,16 @@ bool HTMLParser::IsHTMLFormat( const sal_Char* pHeader,
+ 
+     sCmp = sCmp.toAsciiLowerCase();
+ 
++    sal_Char c;
++    sal_Int32 nPos;
++    for (nPos = 0; nPos < sCmp.getLength(); ++nPos)
++    {
++        c = sCmp[nPos];
++        if (c != ' ' && c != '\n' && c != '\t' && c != '\r' && c != '\f')
++            break;
++    }
++    sCmp = sCmp.copy(nPos);
++
+     // A HTML document must have a '<' in the first line
+     sal_Int32 nStart = sCmp.indexOf('<');
+     if (nStart == -1)
+@@ -1932,8 +1942,6 @@ bool HTMLParser::IsHTMLFormat( const sal_Char* pHeader,
+     nStart++;
+ 
+     // followed by arbitrary characters followed by a blank or '>'
+-    sal_Char c;
+-    sal_Int32 nPos;
+     for( nPos = nStart; nPos < sCmp.getLength(); ++nPos )
+     {
+         if( '>'==(c=sCmp[nPos]) || HTML_ISSPACE(c) )
+-- 
+1.9.3
+
diff --git a/libreoffice.spec b/libreoffice.spec
index d4939c6..6b37033 100644
--- a/libreoffice.spec
+++ b/libreoffice.spec
@@ -36,7 +36,7 @@ Summary:        Free Software Productivity Suite
 Name:           libreoffice
 Epoch:          1
 Version:        %{libo_version}.2
-Release:        1%{?libo_prerelease}%{?dist}
+Release:        2%{?libo_prerelease}%{?dist}
 License:        (MPLv1.1 or LGPLv3+) and LGPLv3 and LGPLv2+ and BSD and (MPLv1.1 or GPLv2 or LGPLv2 or Netscape) and Public Domain and ASL 2.0 and Artistic and MPLv2.0
 Group:          Applications/Productivity
 URL:            http://www.libreoffice.org/
@@ -296,6 +296,7 @@ Patch38: 0001-deb-749592-mysql-connector-doesn-t-work-with-remote-.patch
 Patch39: 0001-Resolves-rhbz-1104068-crash-converting-fontwork-to-c.patch
 Patch40: 0001-rhbz-1105376-move-FlatODF-filter-config-to-right-pla.patch
 Patch41: 0001-move-UOF-and-Office-2003-filters-to-xsltfilter-modul.patch
+Patch42: 0001-fix-detection-of-Salesforce-html.patch
 
 %define instdir %{_libdir}
 %define baseinstdir %{instdir}/libreoffice
@@ -2246,6 +2247,10 @@ update-desktop-database %{_datadir}/applications &> /dev/null || :
 %endif
 
 %changelog
+* Tue Jul 01 2014 Caolán McNamara <caolanm at redhat.com> - 1:4.2.5.2-2
+- fix detection of salesforce html pretending to be .xls by stripping
+  leading whitespace before <!DOCTYPE line
+
 * Thu Jun 12 2014 David Tardon <dtardon at redhat.com> - 1:4.2.5.2-1
 - update to 4.2.5
 


More information about the scm-commits mailing list