Bug 433990 - Dolphin does not trim leading/trailing spaces from new tags
Summary: Dolphin does not trim leading/trailing spaces from new tags
Status: CONFIRMED
Alias: None
Product: baloo-widgets
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: 24.08.1
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Stefan Brüns
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-03-05 09:06 UTC by tagwerk19
Modified: 2024-09-19 15:45 UTC (History)
3 users (show)

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


Attachments
Comparision of Assign Tags, Information Panel and Tag Folder views (81.08 KB, image/png)
2021-05-22 07:23 UTC, tagwerk19
Details

Note You need to log in before you can comment on or make changes to this bug.
Description tagwerk19 2021-03-05 09:06:40 UTC
SUMMARY:

    Dolphin can create tags/tag components with leading/trailing spaces,
    these are shown as distinct in the tag list 

STEPS TO REPRODUCE:

    Create a test file and attach tags "mytag", " mytag", "mytag ",
    " mytag " and "parenttag / mytag" (using "Assign Tags" from context menu)

    Check the file with "getfattr -d ..."

OBSERVED RESULTS

    # file: testfile.jpg
    user.xdg.tags="mytag,mytag , mytag, mytag ,parenttag / mytag"

EXPECTED RESULTS

    Leading and trailing spaces should be trimmed from tag components
    before being saved

SOFTWARE/OS VERSIONS

    Neon Testing

    Dolphin : 20.12.3
    Plasma : 5.21.2
    Frameworks : 5.80.0
    Qt : 5.15.2 

ADDITIONAL INFORMATION

    Works better in the information panel "Tags" dialog but that still
    stumbles on tag components, as when creating "parenttag / mytag"

    (I see the discussion for filenames in bug 383376. Gut feeling is that
    if you really want a leading/trailing space, you should explicitly
    quote them. That's probably a separate discussion though)
Comment 1 tagwerk19 2021-05-22 07:23:24 UTC
Created attachment 138664 [details]
Comparision of Assign Tags, Information Panel and Tag Folder views

There's a similar behaviour with leading or trailing slashes on tags...

STEPS TO REPRODUCE

    Make sure Baloo is running in order to see the tag folders under "Places"

    Create a testfile and create, with "Assign Tags", the tags "/tag"
    and "tag/". Confirm the tags have been written with getfattr:

            getfattr -d testfile.txt

            # file: testfile.txt
            user.xdg.tags="/tag,tag/"

OBSERVED RESULTS

    Go back to the file with "Assign Tags" and see what it shows

        * /tag
          tag
        * tag/

    Compare the info to that displayed in the Information Panel and listed
    under "Places" (see attachment...)

EXPECTED RESULTS

    "Assign Tags", the Information Panel and the Tag Folders under
    "Places" should be consistent.

    Maybe "Assign Tags" should drop leading and trailing slashes as
    typed in, should cope with existing leading/trailing slashes when
    it meets them. 

ADDITIONAL INFORMATION

    The information panel doesn't get it quite right either...
Comment 2 reports_go_brrr 2024-09-17 16:49:52 UTC
Hi tagwerk19.
First of all, thank you for your contributions and your help here.

I reproduced the problem you described in first message. Yes, these spaces should be trimmed.
There is a trouble with second message, I can't reproduce this problem.
In my case of:
# file: Issue.md
user.xdg.tags="/tag,tag/"

It only shows "/tag" and "tag/" in "Assign Tags" of Context menu.
Comment 3 tagwerk19 2024-09-18 07:09:15 UTC
(In reply to reports_go_brrr from comment #2)
> First of all, thank you for your contributions and your help here.
No problem :-)

I'd say I don't manage to keep track of all the various bug reports, so thank you for checking and confirming.
> There is a trouble with second message, I can't reproduce this problem.
> In my case of:
> # file: Issue.md
> user.xdg.tags="/tag,tag/"
> 
> It only shows "/tag" and "tag/" in "Assign Tags" of Context menu.
For me, with a quick test on Fedora 40, I still get "/tag", "tag" and "tag/" appearing in Assign Tags. Let me try elsewhere....

My gut feeling is that the slash should be considered a separator, it's important in parent/tag but leding or trailing tags should be ignored when listed or input.

There would be a case for treating leading and trailing tags as important in searches - you might want to search for "/tag" or "tag/" and find hierarchical tags, where "/tag" is a child and "tag/" is a parent.
Comment 4 reports_go_brrr 2024-09-19 15:45:03 UTC
To tagwerk19,
The usage of  "/tag" or "tag/" for finding parents of tags and it's sub-tags is indeed a good solution for slashes. But I think in that case slashes need to be stripped away during tags creation completely, to avoid problems. So I am kinda skeptical about it.