From d9a4e323555d01202dd15e71a3a32294bfd568cc Mon Sep 17 00:00:00 2001 From: Szymon Kłos Date: Wed, 5 Jan 2022 17:29:49 +0100 Subject: 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 Reviewed-by: Miklos Vajna --- filter/source/textfilterdetect/filterdetect.cxx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'filter') 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 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(); -- cgit