Threadless

colorfool
colorfool aka Axel Christ is a 35.62 year old boy, has been a member since January 4, 2009, has scored 259 submissions, giving an average score of 2.86, helping 11 designs get printed.
Did you also come across this buggin' bug about slogans being cut off in weird places just because of some " or &?

Just in case nobody at threadless knows why this happens:
It most likely happens because the length of the database field to store a slogan is set to exactly 65 chars. Before saving a slogan, special chars get converted to HTML representations like "& q u o t ;" or "& a m p ;" so the slogan gets longer and doesn't fit in the database column any more.

The solution is:
Always store the original in the database, never a changed version. The conversion should only be done on output.

If you feel that this creates too much stress on the server because that way the conversion has to be done every time the slogan is displayed then you could, of course, also extend the length of the database field. You just need to check the slogan's length once before converting special chars. The database field would have to allow for 390 chars (65 * 6) to cover the worst case scenario.

ivejustquitsmoking
   ivejustquitsmoking on Feb 06 '09 at 2:39am
threadless should hire you,
colorfool
colorfool on Feb 06 '09 at 2:51am
I just noticed one more: if you write a blog with an & in the title and you edit and save it multiple times then the title changes every time... every time replacing the & with "& amp ;". That should be easy to fix, too... especially seeing that the body text does not behave in that way.
Steelplate
Steelplate on Feb 06 '09 at 2:53am
I want to lick your sexy brain.
colorfool
colorfool on Feb 06 '09 at 2:55am
For that I would have to take my hat off. So it's a no.
FRICKINAWESOME
   FRICKINAWESOME on Feb 06 '09 at 4:19am
I never understood why Threadless couldn't fix this...after all, they fixed the problem of posting links to other versions of your submission in the "about my design" comment section once it was brought to their attention.
7 days later
Bio-bot 9000
Bio-bot 9000 on Feb 13 '09 at 6:32pm
yeah, fix this, Threadless!



11 days later
Nice.s.t.e.e.
Nice.s.t.e.e. on Feb 25 '09 at 6:07pm
d@mn, i did have the amp in my slogan(s)...

nobody would have probably voted (+) for it but curse you anyway html...

Threadless, quit slackin' on ya' pimpin'...
colorfool
colorfool on Feb 26 '09 at 2:30am
I just found this slogan in Shandela's profile which nicely illustrates that the cut-off really happens like that: "Famous last words: "Don't worry, I saw this on YouTube.&quo"
15 days later
pyko
pyko on Mar 13 '09 at 9:15am
the reason why the store the converted version in the database is probably because of possibility of sql/script injection.



imo a possible solution is (2 steps)

1. have an extra field with "extra/printing instructions"

2. not limit the length of slogan displayed for voting



simply because...some slogans with instructions on where/how to print instructions detract from the slogan itself + atm you can't have a 65char slogan AND put in instructions. So now the slogan box can have a hard limit of 65char; the database limit and display for voting just displays everything. ..



ps was going to say if you limit the char length on input there shouldn't be any super long/malformed slogans, however the checking is done client-side...but if any slogans do exceed the 65char limit they can be disqualified
pyko
pyko on Mar 13 '09 at 9:22am
oops my bad (need more sleep). the javascript was just the counter/warning that told you how many char you had left - so that's all good :)
colorfool
colorfool on Mar 13 '09 at 9:39am
I am not sure that the reason is preventing injection... injection can be prevented by escaping all special chars, that way you can write any content to the db without risk. Since threadless does seem to have performance problems at times my guess still is that the reason is that they don't want to do the conversion every time they output the slogan, so they only convert to htm once on input.
Bramish
   Bramish on Mar 13 '09 at 9:41am
That happened to one of mine over and over until I changed the & for a +
pyko
pyko on Mar 13 '09 at 9:44am
though even if a '&' is saved as "& amp ;" in the database, when displayed it shld show up as '&' coz the HTML will parse it wouldn't it...?
colorfool
colorfool on Mar 13 '09 at 9:56am
Yes, it will certainly show up correctly. But the whole slogan is cut of at a fixed limit of 65, counting the html code. Sometimes you can see the html replacement, if you have a " or an & at the end of your slogan and the 65 char limit takes away the last ; of the html... then you can see "&amp" written out, for example.
Bramish
   Bramish on Mar 13 '09 at 10:01am
My one was cut off way before the 65 limit or the &
colorfool
colorfool on Mar 13 '09 at 10:04am
@Bramish: An & internally translates into 5 chars... so it might have been cut of at 60... if you also used quotes or other special chars then it gets even worse... a " translates into 6 chars in the database.
5 days later
colorfool
colorfool on Mar 19 '09 at 3:33am
Fix it, fix it!
21 days later
evan3
   evan3 on Apr 09 '09 at 7:13pm
i love you hidden level slogan

check mine out posible?
You must be logged in to leave a comment.

My gallery photos

I haven't submitted any photos. I guess I don't want free money.

All about me

See how my Mystical Sloganeering Quotient compares:
Slogan Statistics

Screenshot: Slogan Statistics Page