After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 509792 - Commas need special treatment in tag names
Commas need special treatment in tag names
Status: RESOLVED WONTFIX
Product: f-spot
Classification: Other
Component: Editing
SVN
Other All
: Normal normal
: ---
Assigned To: F-spot maintainers
F-spot maintainers
gnome[unmaintained]
: 565653 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2008-01-16 00:23 UTC by Ulf Rompe
Modified: 2018-07-01 09:04 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Ulf Rompe 2008-01-16 00:23:54 UTC
It is possible to create and use tags containing commas, but using the tag editor (the one that appears when you press "t" on a photo) on photos tagged with these names leads to an annoying behaviour:

     1. Create a tag named "cretins, bastards, idiots, etc."
     2. Add this tag to a photo of your choice.
     3. View this photo and type "T" to open the tag editor.
     4. Edit the tags, e.g., add "Hidden", and press Enter.
     5. Find new tags in your tag view: "cretins", "bastards", "idiots"
        and "etc." are separate tags now.

This is of course just based on the fact that "," is used as a field
separator in the tag editor and is thus absolutely logical, but one
should be aware of this when using commas in tag names. I know someone
who accidently messed up his tag tree quite a bit this way.

F-Spot could easily forbid commas on tag creation, but then, what should
it do when importing already tagged images with tags containing commas?
Or, if commas are valid in tag names, maybe the tag editor should
display them with an escape character like "\," and interpret them the
same way? To be able to use "\" in tag names, that would have to be
converted to "\\", respectively.

Maxxer commented via mailinglist that using backslashes would be really bad for users and suggested enclosing tags containing commas in double quotes.

That's OK if only tags containing commas are enclosed in double quotes, since forcing the user to enclose every tag in "" would be
annoying.

But how should double quotes in tag names be handled then? Just forbidding double quotes in tag names would bring up the same problems as forbidding commas would do. Using \" would bring up the same usability
issue mentioned above. Using "" would be a bit delusive (imagine a tag
printed as '"this ""is a"" tag"'), but that's what is used in CSV files which by their nature share the same problem I'm describing here. In fact, both mentioned posibilities are widely used in CVS files, but the latter one made it into RFC 4180, so maybe we should also stick to that solution. See section 2, item 7 for reference: http://tools.ietf.org/html/rfc4180#section-2

So, to make a long story short, I would propose the following small changes to the tag editor:

     1. On displaying, if a tag name contains commas, it is enclosed in
        double quotes.
     2. On displaying, if a tag name contains double quotes, double them.
     3. On saving, if a sole double quote is encountered, read everything
        until the next sole double quote or end of string as a single tag.
     4. On saving, convert doubled double quotes to single ones.

A simpler alternative would be to forget the double quotes and just use doubled commas to express a literal comma in the tag editor. "My tiny, shiny tag" would just become "My tiny,, shiny tag" that way, and the proposal would shrink to these points:

     1. On displaying, if a tag name contains commas, double them.
     2. On saving, split on single commas, not doubled commas.
     3. On saving, convert doubled commas to single ones.

This being simpler to code and to use as well, I want to vote for this solution. 
It would just have to be documented, but that would be true for any solution.
If the developer team is OK with this, I think I can provide a patch.
Comment 1 Maxxer 2008-12-25 23:34:15 UTC
*** Bug 565653 has been marked as a duplicate of this bug. ***
Comment 2 André Klapper 2018-07-01 09:04:23 UTC
f-spot is not under active development anymore, has not seen code changes for five years, and saw its last tarball release in the year 2010.
Its codebase has been archived: https://gitlab.gnome.org/Archive/f-spot/commits/master

Closing this report as WONTFIX as part of Bugzilla Housekeeping to reflect reality. Please feel free to reopen this ticket (or rather transfer the project to GNOME Gitlab, as GNOME Bugzilla is deprecated) if anyone takes the responsibility for active development again.