SUMMARY My database had a tag with an unintended trailing space character. Clicking on the tag showed zero thumbnails even though KPhotoalbum reported in the listview that the tag was assigned to hundreds of images. This is reproducible with git master. STEPS TO REPRODUCE 1. Open the demo database, click Events and then click on the "desktop" tag. Four thumbnails are displayed. 2. Select an image, open the annotation dialog, and rename the "desktop" tag to "desktop " (with a trailing space). 3. Click home, then Events. Note that the trailing whitespace is not obvious in the list view. 4. Click on the "desktop " tag. No thumbnails are displayed. OBSERVED RESULT The tag cannot be used to select images. EXPECTED RESULT The user should not be able to create a tag name with leading/trailing whitespace. SOFTWARE/OS VERSIONS Linux/KDE Plasma: Ubuntu 22.04.3 LTS KDE Frameworks Version: 5.104.0 Qt Version: 5.15.3 ADDITIONAL INFORMATION Trailing whitespace is not obvious unless the tag name is selected in an edit control. The same issue occurs with leading whitespace in the tag name, but it is more obvious if the tags are displayed in a list view because the tag name appears indented.
A better expected result: an image should always be selectable using an assigned tag. This is arguably a bug in the image selection logic, but is there a reason to allow leading/trailing whitespace in a tag name?
The same behavior can also be triggered in the following ways: - by annotating via the image viewer and adding a new tag using the "new" annotation mode ("F2", then "Ctrl-A", "Add tag") - by renaming a tag group via Settings | Tag groups
I didn't look into the reason why you can't navigate to a tag that begins or ends with a whitespace character, but you're right with your question - the bug is that these names can be entered at all.
Git commit 7a1b41e5847efb2a9d9b5c8e34520a92ae726f1d by Johannes Zarl-Zierl. Committed on 11/02/2024 at 15:57. Pushed by johanneszarl into branch 'master'. Prevent addition of tag names with leading/trailing whitespace M +19 -3 AnnotationDialog/ListSelect.cpp M +14 -7 Settings/TagGroupsPage.cpp M +2 -1 Viewer/SelectCategoryAndValue.cpp https://invent.kde.org/graphics/kphotoalbum/-/commit/7a1b41e5847efb2a9d9b5c8e34520a92ae726f1d
Git commit 7b97f61b160eda5aa1443bb22d4093cd0a7112e8 by Johannes Zarl-Zierl. Committed on 11/02/2024 at 15:42. Pushed by johanneszarl into branch 'master'. Prevent introduction of trailing/leading whiteespace for tag names This is only preventing unsanitized names to be entered into the database, but does not prevent inconsistent UI. M +11 -9 DB/Category.cpp M +14 -3 DB/Category.h M +25 -21 DB/MemberMap.cpp M +5 -1 DB/MemberMap.h https://invent.kde.org/graphics/kphotoalbum/-/commit/7b97f61b160eda5aa1443bb22d4093cd0a7112e8