<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.kde.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugs.kde.org/"
          
          maintainer="sysadmin@kde.org"
>

    <bug>
          <bug_id>512728</bug_id>
          
          <creation_ts>2025-11-28 15:26:37 +0000</creation_ts>
          <short_desc>searching for _v in filename to detect versions returns erroneous results</short_desc>
          <delta_ts>2025-12-25 10:54:52 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>2</classification_id>
          <classification>Applications</classification>
          <product>digikam</product>
          <component>Searches-Advanced</component>
          <version>8.8.0</version>
          <rep_platform>Microsoft Windows</rep_platform>
          <op_sys>Microsoft Windows</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>WORKSFORME</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>NOR</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>0</everconfirmed>
          <reporter name="Steve Franks">stevef48</reporter>
          <assigned_to name="Digikam Developers">digikam-bugs-null</assigned_to>
          <cc>caulier.gilles</cc>
    
    <cc>metzpinguin</cc>
          
          <cf_commitlink></cf_commitlink>
          <cf_versionfixedin>9.0.0</cf_versionfixedin>
          <cf_sentryurl></cf_sentryurl>
          <votes>0</votes>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2473368</commentid>
    <comment_count>0</comment_count>
    <who name="Steve Franks">stevef48</who>
    <bug_when>2025-11-28 15:26:37 +0000</bug_when>
    <thetext>When searching for versions (file_v1) the results include all files with v in their name, or extension.

SUMMARY
I accidentally ran BQM without changing the option to overwrite original file, so ended up with lots of _v1 files.
To find these I ran search with _v as filename to match. The results included .Avi .WAV and other files that have the letter v in their name, or extension, but not the underscore.

STEPS TO REPRODUCE
1.  Click on Search | New Advanced Search
2.   Enter _v in the filename | click on OK
3.  Cherck the results

OBSERVED RESULT


EXPECTED RESULT


SOFTWARE/OS VERSIONS
Windows: 
macOS: 
(available in the Info Center app, or by running `kinfo` in a terminal window)
Linux/KDE Plasma: 
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2473370</commentid>
    <comment_count>1</comment_count>
    <who name="Steve Franks">stevef48</who>
    <bug_when>2025-11-28 15:35:52 +0000</bug_when>
    <thetext>OBSERVED RESULT


EXPECTED RESULT


SOFTWARE/OS VERSIONS
Windows:  11
macOS: 
(available in the Info Center app, or by running `kinfo` in a terminal window)
Linux/KDE Plasma:   Fedora 43
KDE Plasma Version : 6.5.3 
KDE Frameworks Version: 6.20.0
Qt Version:  6.10.1

ADDITIONAL INFORMATION</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2473380</commentid>
    <comment_count>2</comment_count>
    <who name="Maik Qualmann">metzpinguin</who>
    <bug_when>2025-11-28 17:15:29 +0000</bug_when>
    <thetext>It&apos;s a &quot;LIKE&quot; database search. You need to escape such characters with a &quot;\&quot; at the front. So type: \_v

Maik</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2473445</commentid>
    <comment_count>3</comment_count>
    <who name="Maik Qualmann">metzpinguin</who>
    <bug_when>2025-11-29 04:56:37 +0000</bug_when>
    <thetext>This is the old Bug 430147 from when we added the escape function to SQLite as well.

Maik</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2473447</commentid>
    <comment_count>4</comment_count>
    <who name="">caulier.gilles</who>
    <bug_when>2025-11-29 05:19:52 +0000</bug_when>
    <thetext>Hi Maik,

Can we do the special characters escape automatically ? As i know, if we search file name with these characters must be prepared previously:

- _ : \_
- % : \%
- &apos; : &apos;&apos;
- &quot; : &quot;&quot;
- ; : must be removed as it close an sql instruction.

I&apos;m right ?
Gilles</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2473448</commentid>
    <comment_count>5</comment_count>
    <who name="Maik Qualmann">metzpinguin</who>
    <bug_when>2025-11-29 06:58:18 +0000</bug_when>
    <thetext>There aren&apos;t many characters that need to be escaped in a LIKE SQL statement; see this MS Doc. The underscore is one of them.

https://learn.microsoft.com/en-us/sql/t-sql/language-elements/like-transact-sql?view=sql-server-ver15#using-wildcard-characters-as-literals

The semicolon (&quot;;&quot;) as the end character is generally unproblematic, since we already encapsulate the search strings in the SQL statement.

I&apos;ll look into whether we can escape characters in SQL statements in general and whether there might be any side effects.

Maik</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>