Uppercase / lowercase in Linktrimmer

Creating and modifying plugins.
Post Reply
danst0
Regular
Posts: 197
Joined: Tue Jul 13, 2004 10:50 am

Uppercase / lowercase in Linktrimmer

Post 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
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Uppercase / lowercase in Linktrimmer

Post 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
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
danst0
Regular
Posts: 197
Joined: Tue Jul 13, 2004 10:50 am

Re: Uppercase / lowercase in Linktrimmer

Post 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
Attachments
Screen shot 2011-05-06 at 16.10.41.png
Screen shot 2011-05-06 at 16.10.41.png (38.7 KiB) Viewed 5625 times
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Uppercase / lowercase in Linktrimmer

Post 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
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
danst0
Regular
Posts: 197
Joined: Tue Jul 13, 2004 10:50 am

Re: Uppercase / lowercase in Linktrimmer

Post by danst0 »

I put it on utf, but it still does not seem to work.

Daniel
Attachments
Screen shot 2011-05-06 at 17.33.09.png
Screen shot 2011-05-06 at 17.33.09.png (19.78 KiB) Viewed 5623 times
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Uppercase / lowercase in Linktrimmer

Post by garvinhicking »

Hi!

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

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
danst0
Regular
Posts: 197
Joined: Tue Jul 13, 2004 10:50 am

Re: Uppercase / lowercase in Linktrimmer

Post by danst0 »

Oh, my fault, I suppose cs is for case sensitive. But there is no _cs encoding listed at all?!
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Uppercase / lowercase in Linktrimmer

Post by garvinhicking »

Hi!

Hm, youre right! Use latin1_general_cs then :)

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
danst0
Regular
Posts: 197
Joined: Tue Jul 13, 2004 10:50 am

Re: Uppercase / lowercase in Linktrimmer

Post by danst0 »

now it works... Thanks!

Could this be set somewhere during creation of the table?

Daniel
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Uppercase / lowercase in Linktrimmer

Post by garvinhicking »

Hi!

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

Thanks,
Regarvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Post Reply