Page 1 of 1

Uppercase / lowercase in Linktrimmer

Posted: Fri May 06, 2011 3:48 pm
by danst0
Hi,

Just stumbled upon two major bugs in the linktrimmer plugin:
- Short url hashes are created in lower and uppercase... sadly at least my browser / apache does not differentiate and there is probably an rfc prohibiting that... I fixed that and changed the base62 to only include lower case letters...

- A short url is not only created on demand, but every time someone visits the page. And as my database shows also _double links are created_ (and I have not found out why, it has to be related to the sql query in line 128, that it does not find a preexisting value).
But the main question is: why bother and create a shortlink for every article read??

You can find the patch here (http://dl.dropbox.com/u/285107/linktrimmer2.patch), please have a look!

Daniel

Re: Uppercase / lowercase in Linktrimmer

Posted: Fri May 06, 2011 3:56 pm
by garvinhicking
Hi!

That's odd and shouldn't be...the casing should be preserved, it's preserved in all other GET/POST vars...

About the second thing, I don't really understand how that should happen. Lookup() is only created when you submit a new URL. Maybe this comes from your twitter integration, and not the plugin itself?! We would need a way to reproduce this so that it can be analyzed...

Regards,
Garvin

Re: Uppercase / lowercase in Linktrimmer

Posted: Fri May 06, 2011 4:17 pm
by danst0
yeah... the twitter part is producing the double entries...;-( I forgot about that. I am going to post a fix.

The other problem prevails, I made a screenshot of my linktrimmer database. Try to go to scrmblog.com/s/A and you'll end up at /s/a

Daniel

Re: Uppercase / lowercase in Linktrimmer

Posted: Fri May 06, 2011 4:21 pm
by garvinhicking
Hi!

Ah! Okay, I understand - I believe the trouble is MySQL looking up "hash = 'a'" and also returns hash=A.

Check the collation of ryour "hash" column, see if its "utf8_general_cs" (and NOT ci, case insensitive)?

IMHO it's nice to have lower and uppercase, because that leaves more space until URLs get longer...

Regards,
Garvin

Re: Uppercase / lowercase in Linktrimmer

Posted: Fri May 06, 2011 5:39 pm
by danst0
I put it on utf, but it still does not seem to work.

Daniel

Re: Uppercase / lowercase in Linktrimmer

Posted: Fri May 06, 2011 8:39 pm
by garvinhicking
Hi!

Please read carefully! I said to turn it to *CS* not *CI*! :)

Regards,
Garvin

Re: Uppercase / lowercase in Linktrimmer

Posted: Fri May 06, 2011 9:12 pm
by danst0
Oh, my fault, I suppose cs is for case sensitive. But there is no _cs encoding listed at all?!

Re: Uppercase / lowercase in Linktrimmer

Posted: Fri May 06, 2011 9:23 pm
by garvinhicking
Hi!

Hm, youre right! Use latin1_general_cs then :)

Regards,
Garvin

Re: Uppercase / lowercase in Linktrimmer

Posted: Fri May 06, 2011 9:30 pm
by danst0
now it works... Thanks!

Could this be set somewhere during creation of the table?

Daniel

Re: Uppercase / lowercase in Linktrimmer

Posted: Mon May 09, 2011 10:32 am
by garvinhicking
Hi!

Yes, I've now also patched it into the plugin!

Thanks,
Regarvin