Author Topic: Url parsing  (Read 1948 times)

hamen

  • Newbie
  • *
  • Posts: 12
    • View Profile
Url parsing
« on: December 07, 2009, 07:50:50 pm »
Opengoo 1.6b2

If an email contains an url like:

Code: [Select]
http://something.com/user/+post/12345
Opengoo breaks url at .../user/ . It loses everything after "+" symbol.
I know it can seem a weird url, but it's common on launchpad.net.
hamen

ignacio

  • Hero Member
  • *****
  • Posts: 1703
    • View Profile
Re: Url parsing
« Reply #1 on: December 08, 2009, 11:06:44 am »
Hi hamen,

Please try if this fixes it. Change lines 570-574 of file 'environment/functions/general.php' from:

Code: [Select]
//Replace full urls with hyperinks. Avoids " character for already rendered hyperlinks
$text = preg_replace('@([^"\']|^)(https?://([-\w\.]+)+(:\d+)?(/([\w/_\-\.]*(\?\S+)?)?)?)@', '$1<a href="$2" target="_blank">$2</a>', $text);

//Convert every word starting with "www." into a hyperlink
$text = preg_replace('@(>|\s|^)(www.([-\w\.]+)+(:\d+)?(/([\w/_\-\.]*(\?\S+)?)?)?)@', '$1<a href="http://$2" target="_blank">$2</a>', $text);

to:

Code: [Select]
//Replace full urls with hyperinks. Avoids " character for already rendered hyperlinks
$text = preg_replace('@([^"\']|^)(https?://([-\w\.]+)+(:\d+)?(/([\w/_\-\.\+]*(\?\S+)?)?)?)@', '$1<a href="$2" target="_blank">$2</a>', $text);

//Convert every word starting with "www." into a hyperlink
$text = preg_replace('@(>|\s|^)(www.([-\w\.]+)+(:\d+)?(/([\w/_\-\.\+]*(\?\S+)?)?)?)@', '$1<a href="http://$2" target="_blank">$2</a>', $text);

Thanks!

hamen

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: Url parsing
« Reply #2 on: December 08, 2009, 05:40:44 pm »
That solved the issue. Nice work ;)
hamen