Strange behavior with pluses in tags

TalkBug Collectors

Join LibraryThing to post.

Strange behavior with pluses in tags

1lorax
Jul 18, 2007, 12:31 pm

I recently noticed the book in my library which I had tagged as "c++" was instead tagged with "c". The tag "c++" does not appear in my tag list, and the count of c-tagged books includes it. Deleting the tag and re-tagging has no effect; the pluses are being stripped.

However, the tag "c++" does exist in LT somehow: http://www.librarything.com/tag/c%252B%252B&norefer=1

though I can't see whether my book shows up there, since the "show all" links for both users and titles remove the encodings in the URL in favor of literal pluses, which map it back to showing "c". (Putting the encodings back in by hand doesn't work.)

Apparently this isn't consistent, though; some people are fortunate enough to be able to get their tags to display as "c++", if you put the encodings in by hand into the URL
http://www.librarything.com/catalog/TimSharrock&tag=c%252B%252B&alias=1
though I can't begin to figure out how he did it.

Stripping pluses I could live with, since this is probably the only case where it makes a real difference in the meaning of the tag (and I've done the same workaround that others have, of using "cplusplus", which despite being combined with "c++" doesn't exist in the same strange limbo, and gives me correct totals for "c" in my catalog), but the inconsistency where "c++" exists as a distinct tag only in certain areas and for certain people is very annoying.

2readafew
Jul 18, 2007, 12:34 pm

yep, a known bug...

3ArlieS
Jul 27, 2021, 11:32 pm

Current misbehaviour - this is still broken on the "add book" page, but no longer broken on the "edit book" page. See https://www.librarything.com/topic/333870.

4Nicole_VanK
Jul 28, 2021, 12:59 am

This report is ancient (and, more importantly, from before the bug tracking system was installed). You will have a much better chance of it being noticed by staff if you create a new report.

5kristilabrie
Jul 28, 2021, 8:42 am

>4 Nicole_VanK: The post >3 ArlieS: noted in their post is their new bug report.

6Nicole_VanK
Jul 28, 2021, 9:43 am

>5 kristilabrie: Okay. I was just worrying this might not get get noticed.

7ArlieS
Jul 28, 2021, 1:29 pm

>6 Nicole_VanK: I'm really unclear on what causes the developers to notice bug reports, so I've been doing whatever I can to make this visible, including necro-posting on threads for semi-duplicates.

If there's a better way, I'd be happy to use it.

But to give an idea of how lazy I am, I haven't even checked whether the project is open source, and if so what language it's in. (As you can imagine, like most people cataloguing C++ books, I have some level of programming ability, though not so much in languages typically used for web sites.)

8bnielsen
Jul 28, 2021, 3:25 pm

>7 ArlieS: There are a bunch of bugs hiding here, because the tags are put into the urls without any protection. The tags could have been protected like this http://www.librarything.com/catalog/TimSharrock&tag=632B2B
or something similar. I.e. using some sort of safe encoding.
The problem with not protecting them is that some characters have special meanings in an url, i.e. ampersand and percentage. + can be "percentage encoded" as %2B and I think that it's another bug/feature that you need to do it twice, i.e. "percentage encode" the % too. That's encoded as %25, so thats where %25%2B comes from. It's "just" a plus-sign wrapped twice.
http://www.librarything.com/catalog/TimSharrock&tag=c%252B%252B
Of course you can encode "c" too:
http://www.librarything.com/catalog/TimSharrock&tag=%63%252B%252B

9TimSharrock
Jul 28, 2021, 3:47 pm

nice too see my library mentioned, I really must update it! and add some more C++ books...

10bnielsen
Jul 28, 2021, 5:20 pm

>9 TimSharrock: and do some more tag encoding tricks ?

http://www.librarything.com/tag/%2e

11ArlieS
Jul 28, 2021, 7:11 pm

>8 bnielsen: When I select my C++ tag here: https://www.librarything.com/catalog/ArlieS it automatically gives me a URL like this: https://www.librarything.com/catalog/ArlieS&tag=C%252B%252B

So the site is doing the encoding automagically.

I turned on "view page source" and looked at the frame called catalog_tags.php

In the page source for the framewith the clickable list of tags, there are three occurences of the name of each tag. One of these is part of the URL embedded in a link, and this one - but not the other two - has the + signs in the % syntax. The other two are plain text.

Here's a tag that's entirely text:

<div class="tag" id="t506" onmouseover="ti(506, 'abuse', 1)">
<div class="tagword"><a href="/catalog/ArlieS&tag=abuse" target="_top"><img src="/pics/silk/tag_green.png" width="16" height="16">abuse</a> (1)</div>

And here's the offending C++ tag, which works completely correctly on this page AFAICT:

<div class="tag" id="t1043464" onmouseover="ti(1043464, 'C++', 1)">
<div class="tagword"><a href="/catalog/ArlieS&tag=C%252B%252B" target="_top"><img src="/pics/silk/tag_green.png" width="16" height="16">C++</a> (5)</div>