filter/source/textfilterdetect/filterdetect.cxx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
New commits: commit faed3047e9fa7e8ed6d33f1801e661a4e56d46c1 Author: Szymon Kłos <[email protected]> AuthorDate: Wed Jan 5 17:29:49 2022 +0100 Commit: Miklos Vajna <[email protected]> CommitDate: Fri Jan 7 13:34:45 2022 +0100 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 <[email protected]> Reviewed-by: Miklos Vajna <[email protected]> (cherry picked from commit d9a4e323555d01202dd15e71a3a32294bfd568cc) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127966 diff --git a/filter/source/textfilterdetect/filterdetect.cxx b/filter/source/textfilterdetect/filterdetect.cxx index 4a6314c9224a..08944fad0e5f 100644 --- a/filter/source/textfilterdetect/filterdetect.cxx +++ b/filter/source/textfilterdetect/filterdetect.cxx @@ -156,7 +156,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();
