[libreoffice/f20] avoid problems detecting HTML files with xls ext.
David Tardon
dtardon at fedoraproject.org
Tue Jul 8 15:56:19 UTC 2014
commit 63d924aa120097954f944ec99762a41e53f2b08b
Author: David Tardon <dtardon at redhat.com>
Date: Tue Jul 8 17:13:33 2014 +0200
avoid problems detecting HTML files with xls ext.
(cherry picked from commit e4aa87326b3aea870203b634ba52d36c1a36915c)
Conflicts:
libreoffice.spec
...oblems-detecting-HTML-files-with-.xls-ext.patch | 96 ++++++++++++++++++++
libreoffice.spec | 6 +-
2 files changed, 101 insertions(+), 1 deletions(-)
---
diff --git a/0001-avoid-problems-detecting-HTML-files-with-.xls-ext.patch b/0001-avoid-problems-detecting-HTML-files-with-.xls-ext.patch
new file mode 100644
index 0000000..85ba462
--- /dev/null
+++ b/0001-avoid-problems-detecting-HTML-files-with-.xls-ext.patch
@@ -0,0 +1,96 @@
+From 86c6f18c2766aad43d6e3bfcf3530e40440ebca7 Mon Sep 17 00:00:00 2001
+From: David Tardon <dtardon at redhat.com>
+Date: Tue, 8 Jul 2014 17:01:27 +0200
+Subject: [PATCH] avoid problems detecting HTML files with .xls ext.
+
+Change-Id: I9955223aac20f3f640fde51bb7231666c269ca70
+---
+ filter/Configuration_filter.mk | 1 +
+ filter/source/config/fragments/types/calc_HTML.xcu | 35 ++++++++++++++++++++++
+ filter/source/textfilterdetect/filterdetect.cxx | 6 ++--
+ 3 files changed, 38 insertions(+), 4 deletions(-)
+ create mode 100644 filter/source/config/fragments/types/calc_HTML.xcu
+
+diff --git a/filter/Configuration_filter.mk b/filter/Configuration_filter.mk
+index e035464..0465f17 100644
+--- a/filter/Configuration_filter.mk
++++ b/filter/Configuration_filter.mk
+@@ -512,6 +512,7 @@ $(call filter_Configuration_add_ui_filters,fcfg_langpack,filter/source/config/fr
+ $(call filter_Configuration_add_types,fcfg_langpack,fcfg_calc_types.xcu,filter/source/config/fragments/types,\
+ calc_DIF \
+ calc_ODS_FlatXML \
++ calc_HTML \
+ generic_HTML \
+ generic_Text \
+ calc_Lotus \
+diff --git a/filter/source/config/fragments/types/calc_HTML.xcu b/filter/source/config/fragments/types/calc_HTML.xcu
+new file mode 100644
+index 0000000..51bf8f1
+--- /dev/null
++++ b/filter/source/config/fragments/types/calc_HTML.xcu
+@@ -0,0 +1,35 @@
++<!--
++ * This file is part of the LibreOffice project.
++ *
++ * This Source Code Form is subject to the terms of the Mozilla Public
++ * License, v. 2.0. If a copy of the MPL was not distributed with this
++ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
++ *
++ * This file incorporates work covered by the following license notice:
++ *
++ * Licensed to the Apache Software Foundation (ASF) under one or more
++ * contributor license agreements. See the NOTICE file distributed
++ * with this work for additional information regarding copyright
++ * ownership. The ASF licenses this file to you under the Apache
++ * License, Version 2.0 (the "License"); you may not use this file
++ * except in compliance with the License. You may obtain a copy of
++ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
++-->
++ <!-- A special case: There are tools that export HTML with .xls
++ extension. Allow to detect these early to avoid going through the
++ whole list of detectors. This also avoids the risk of misdetection
++ as something else, as there are some formats that are text files and
++ the detection is just a heuristic (e.g., wp1 or wp42 supported by
++ libwpd). -->
++ <node oor:name="calc_HTML" oor:op="replace" >
++ <prop oor:name="DetectService"><value>com.sun.star.comp.filters.PlainTextFilterDetect</value></prop>
++ <prop oor:name="URLPattern"/>
++ <prop oor:name="Extensions"><value>xls</value></prop>
++ <prop oor:name="MediaType"><value>text/html</value></prop>
++ <prop oor:name="Preferred"><value>false</value></prop>
++ <prop oor:name="PreferredFilter"/>
++ <prop oor:name="UIName">
++ <value>HTML Table</value>
++ </prop>
++ <prop oor:name="ClipboardFormat"/>
++ </node>
+diff --git a/filter/source/textfilterdetect/filterdetect.cxx b/filter/source/textfilterdetect/filterdetect.cxx
+index ffad7fa..1d29dd4 100644
+--- a/filter/source/textfilterdetect/filterdetect.cxx
++++ b/filter/source/textfilterdetect/filterdetect.cxx
+@@ -132,7 +132,7 @@ OUString SAL_CALL PlainTextFilterDetect::detect(uno::Sequence<beans::PropertyVal
+ OUString aExt = aParser.getExtension(INetURLObject::LAST_SEGMENT, true, INetURLObject::DECODE_WITH_CHARSET);
+ aExt = aExt.toAsciiLowerCase();
+
+- if (aType == "generic_HTML")
++ if ((aType == "generic_HTML") || (aType == "calc_HTML"))
+ {
+ uno::Reference<io::XInputStream> xInStream(aMediaDesc[MediaDescriptor::PROP_INPUTSTREAM()], uno::UNO_QUERY);
+ if (!xInStream.is() || !IsHTMLStream(xInStream))
+@@ -141,12 +141,10 @@ OUString SAL_CALL PlainTextFilterDetect::detect(uno::Sequence<beans::PropertyVal
+ // Decide which filter to use based on the document service first,
+ // then on extension if that's not available.
+
+- if (aDocService == CALC_DOCSERVICE)
++ if ((aDocService == CALC_DOCSERVICE) || (aType == "calc_HTML"))
+ aMediaDesc[MediaDescriptor::PROP_FILTERNAME()] <<= OUString(CALC_HTML_FILTER);
+ else if (aDocService == WRITER_DOCSERVICE)
+ aMediaDesc[MediaDescriptor::PROP_FILTERNAME()] <<= OUString(WRITER_HTML_FILTER);
+- else if (aExt == "xls")
+- aMediaDesc[MediaDescriptor::PROP_FILTERNAME()] <<= OUString(CALC_HTML_FILTER);
+ else
+ aMediaDesc[MediaDescriptor::PROP_FILTERNAME()] <<= OUString(WEB_HTML_FILTER);
+ }
+--
+1.9.3
+
diff --git a/libreoffice.spec b/libreoffice.spec
index 08da8d8..309454b 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: 3%{?libo_prerelease}%{?dist}
+Release: 4%{?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/
@@ -302,6 +302,7 @@ Patch44: 0002-Don-t-go-further-and-pop-the-stack-if-it-s-empty.patch
Patch45: 0003-Use-a-new-fast-parser-instance-for-each-XML-fragment.patch
Patch46: 0001-allow-build-with-icu-4.2.patch
Patch47: 0001-Resolves-fdo-80911-toggle-original-page-orientation-.patch
+Patch48: 0001-avoid-problems-detecting-HTML-files-with-.xls-ext.patch
%define instdir %{_libdir}
%define baseinstdir %{instdir}/libreoffice
@@ -2252,6 +2253,9 @@ update-desktop-database %{_datadir}/applications &> /dev/null || :
%endif
%changelog
+* Tue Jul 08 2014 David Tardon <dtardon at redhat.com> - 1:4.2.5.2-4
+- avoid problems detecting HTML files with xls extension
+
* Fri Jul 04 2014 Caolán McNamara <caolanm at redhat.com> - 1:4.2.5.2-3
- Resolves: rhbz#1089207 crash in OOXML import
- allow building with icu 4.2
More information about the scm-commits
mailing list