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

New commits:
commit 86d5006eed139df3bc0a03cea1c567929caef73e
Author:     Kohei Yoshida <[email protected]>
AuthorDate: Mon Dec 22 20:02:59 2025 -0500
Commit:     Kohei Yoshida <[email protected]>
CommitDate: Wed Dec 24 05:34:13 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
    (cherry picked from commit d669c1b3df498928a63e1d1e08c534d660a04b6d)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196181

diff --git a/filter/source/config/cache/typedetection.cxx 
b/filter/source/config/cache/typedetection.cxx
index 49efe1c1a9f8..69d950ed2552 100644
--- a/filter/source/config/cache/typedetection.cxx
+++ b/filter/source/config/cache/typedetection.cxx
@@ -995,7 +995,7 @@ OUString TypeDetection::impl_detectTypeFlatAndDeep(      
utl::MediaDescriptor& r
     //                                               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
@@ -1043,12 +1043,8 @@ OUString TypeDetection::impl_detectTypeFlatAndDeep(      
utl::MediaDescriptor& r
 
             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