filter/source/config/cache/typedetection.cxx |   10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

New commits:
commit d669c1b3df498928a63e1d1e08c534d660a04b6d
Author:     Kohei Yoshida <[email protected]>
AuthorDate: Mon Dec 22 20:02:59 2025 -0500
Commit:     Kohei Yoshida <[email protected]>
CommitDate: Tue Dec 23 04:30:36 2025 +0100

    tdf#169154: Use detected type even if it differs from requested type
    
    This restores the previous logic where the type reported by the
    detector was used even if it differs from the type being requested.
    This is a partial revert of commit cd347097f726eae68fa819fe244d0bedf13832e9.
    This at least makes the reported problem go away.
    
    Change-Id: Ic33385a3b1fb1c538cd8e79bcf1b7ab3f4ee904e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196142
    Reviewed-by: Kohei Yoshida <[email protected]>
    Tested-by: Jenkins

diff --git a/filter/source/config/cache/typedetection.cxx 
b/filter/source/config/cache/typedetection.cxx
index 0dc12b0ba884..c50c8522a1d2 100644
--- a/filter/source/config/cache/typedetection.cxx
+++ b/filter/source/config/cache/typedetection.cxx
@@ -996,7 +996,7 @@ OUString 
TypeDetection::impl_detectTypeFlatAndDeep(comphelper::SequenceAsHashMap
     //                                               if no further type could 
be detected.
     //                                               It must be the first one, 
because it can be a preferred type.
     //                                               Our types list was sorted 
by such criteria!
-    // d) detect service return a valid result    => return its decision but 
only when it matches the type being tested
+    // d) detect service return a valid result    => return its decision
     // e) detect service return an invalid result
     //    or any needed information could not be
     //    obtained from the cache                 => ignore it, and continue 
with search
@@ -1044,12 +1044,8 @@ OUString 
TypeDetection::impl_detectTypeFlatAndDeep(comphelper::SequenceAsHashMap
 
             OUString sDeepType = impl_askDetectService(sDetectService, 
rDescriptor);
 
-            // d) call it 'detected' only when the reported type matches the
-            // type being checked for.  This is important because many 
detectors
-            // report multiple different types which may mess up our strict 
type
-            // check order e.g when the type being tested is of higher
-            // complexity and the detector reports a type of lower complexity.
-            if (sDeepType == sFlatType)
+            // d)
+            if (!sDeepType.isEmpty())
                 return sDeepType;
         }
         catch(const css::container::NoSuchElementException&)

Reply via email to