Bug 480117 - Tags are not added if their CASE doesn't match the case in the tag database.
Summary: Tags are not added if their CASE doesn't match the case in the tag database.
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Database-Mysql (show other bugs)
Version: 8.2.0
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-01-21 02:17 UTC by Bravo Baavo
Modified: 2024-01-21 16:33 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 8.3.0
Sentry Crash Report:


Attachments
ZIP file containing screenshots and an example album. (220.35 KB, application/zip)
2024-01-21 02:17 UTC, Bravo Baavo
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Bravo Baavo 2024-01-21 02:17:29 UTC
Created attachment 165089 [details]
ZIP file containing screenshots and an example album.

SUMMARY
***
If you import metadata for an image using an XMP sidecar file, and the sidecar contains a tag that is already in the tag database, but the CaSe doesn't match what is in the database, then the tag is ignored.

Attached is a ZIP file with an example image and sidecar as well as some screenshots of the issue. The Tag "girl" is not imported and cannot be seen in Digikam. However in the tag manager the tag "GIRL" already exists. If I change the XMP sidecar tag to "GIRL" then it appears in Digikam.
***


STEPS TO REPRODUCE
1. Add the tag "GIRL" to the database.
2. Enable Settings > Metadata > Read from sidecar files
2. Download the attached ZIP, extract it, and add the Album folder as an Album.

OBSERVED RESULT
The "girl" tag isn't imported.
If you modify the sidecar file and change it to "GIRL" then re-read the metadata (Tools > Maintenance > Sync Metadata and Database > Sync Direction "From image metadata to database") it will appear in the list.

EXPECTED RESULT
One of them should be added, preferably whichever tag already exists in the database should be added.

SOFTWARE/OS VERSIONS
Linux/Ubuntu: 22.04.3
KDE Frameworks Version: 5.110.0
Qt Version: 5.15.11 (built against 5.15.11)

ADDITIONAL INFORMATION
I'm using a MySQL database.
Comment 1 Maik Qualmann 2024-01-21 08:26:16 UTC
A MySQL database is not case-sensitive. Otherwise we would have to use a binary collator, but that brings other problems. Using SQLite would be an alternative if case-sensitive is important to you.

Maik
Comment 2 Maik Qualmann 2024-01-21 08:59:02 UTC

*** This bug has been marked as a duplicate of bug 464853 ***
Comment 3 Bravo Baavo 2024-01-21 11:55:01 UTC
(In reply to Maik Qualmann from comment #1)
> A MySQL database is not case-sensitive. Otherwise we would have to use a
> binary collator, but that brings other problems. Using SQLite would be an
> alternative if case-sensitive is important to you.
> 
> Maik

Hi Maik,
I don't mind if the DB is case-sensitive particularly but the behaviour seems wrong to me:
- If an existing tag is in the database, but doesn't match the case of the tag being imported, then the tag is ignored entirely. I would expect it to add the tag but match the case in the database.

I noticed while opening Digikam is outputs this error a lot, and one of them matches the tag I'm testing with here, not sure if it's related:
> Digikam::AlbumManager::scanTAlbums: Failed to find parent tag for tag  "girl"  with pid  4460

Also, I noticed that the tag does show up under Properties > Tags > Keywords, but doesn't show up in the thumbnail view or under Captions > Tags
Comment 4 Maik Qualmann 2024-01-21 14:25:06 UTC
For MySQL, "girl" is the same as "GIRL" or Girl". If you have "girl" in the database and try to create the tag "GIRL", MySQL will give you an error, but SQLite will not.

It is normal behavior for MySQL string fields. Only binary storage could solve the problem.

Read also https://bugs.kde.org/show_bug.cgi?id=464853#c1

Maik
Comment 5 Bravo Baavo 2024-01-21 14:27:14 UTC
(In reply to Maik Qualmann from comment #4)
> For MySQL, "girl" is the same as "GIRL" or Girl". If you have "girl" in the
> database and try to create the tag "GIRL", MySQL will give you an error, but
> SQLite will not.
> 
> It is normal behavior for MySQL string fields. Only binary storage could
> solve the problem.
> 
> Read also https://bugs.kde.org/show_bug.cgi?id=464853#c1
> 
> Maik

Hi Maik,
but even if we can't add the new tag to the database, can we associate the existing tag with the image still somehow?
Comment 6 Maik Qualmann 2024-01-21 16:31:55 UTC
Git commit c4fa9a3b631e7684722d70780c9c2df27a9e026c by Maik Qualmann.
Committed on 21/01/2024 at 17:30.
Pushed by mqualmann into branch 'master'.

handle case sensitive tags better under MySQL
Related: bug 464853
FIXED-IN: 8.3.0

M  +1    -1    NEWS
M  +1    -1    core/data/database/dbconfig.xml.cmake.in
M  +18   -0    core/libs/database/coredb/coredb.cpp

https://invent.kde.org/graphics/digikam/-/commit/c4fa9a3b631e7684722d70780c9c2df27a9e026c
Comment 7 Bravo Baavo 2024-01-21 16:33:40 UTC
(In reply to Maik Qualmann from comment #6)
> Git commit c4fa9a3b631e7684722d70780c9c2df27a9e026c by Maik Qualmann.
> Committed on 21/01/2024 at 17:30.
> Pushed by mqualmann into branch 'master'.
> 
> handle case sensitive tags better under MySQL
> Related: bug 464853
> FIXED-IN: 8.3.0
> 
> M  +1    -1    NEWS
> M  +1    -1    core/data/database/dbconfig.xml.cmake.in
> M  +18   -0    core/libs/database/coredb/coredb.cpp
> 
> https://invent.kde.org/graphics/digikam/-/commit/
> c4fa9a3b631e7684722d70780c9c2df27a9e026c

Thank you Maik, it's much appreciated :)