summaryrefslogtreecommitdiff
path: root/filter
diff options
context:
space:
mode:
authorSzymon Kłos <szymon.klos@collabora.com>2022-01-05 17:29:49 +0100
committerMiklos Vajna <vmiklos@collabora.com>2022-01-06 08:29:58 +0100
commitd9a4e323555d01202dd15e71a3a32294bfd568cc (patch)
treeaa0557187bd1d3b63ac15de62706b028fd77bc7f /filter
parentcde6577dcb9c94aca7605790d34c83a5ff62edad (diff)
Open empty (0 bytes) ods as spreadsheet
Before this patch we opened it with Writer UI because we didn't detect any filter with PREFFERED annotation Change-Id: I6262fb695b5fe20a377120f298f144e2cafbadc9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128015 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'filter')
-rw-r--r--filter/source/textfilterdetect/filterdetect.cxx7
1 files changed, 6 insertions, 1 deletions
diff --git a/filter/source/textfilterdetect/filterdetect.cxx b/filter/source/textfilterdetect/filterdetect.cxx
index 915020aa117c..0c00abf28e87 100644
--- a/filter/source/textfilterdetect/filterdetect.cxx
+++ b/filter/source/textfilterdetect/filterdetect.cxx
@@ -155,7 +155,12 @@ bool HandleEmptyFileUrlByExtension(MediaDescriptor& rMediaDesc, const OUString&
std::shared_ptr<const SfxFilter> pFilter(SfxFilterMatcher().GetFilter4Extension(rExt, nMust));
if (!pFilter)
{
- return false;
+ // retry without PREFFERED so we can find at least something for 0-byte *.ods
+ nMust = SfxFilterFlags::IMPORT | SfxFilterFlags::EXPORT;
+ pFilter = SfxFilterMatcher().GetFilter4Extension(rExt, nMust);
+
+ if (!pFilter)
+ return false;
}
rMediaDesc[MediaDescriptor::PROP_FILTERNAME()] <<= pFilter->GetFilterName();