URLs in item description get chopped - FIXED IN V3.4

Post Reply
RWAP
Site Admin
Posts: 745
Joined: Fri Jan 08, 2010 2:23 am
Location: Stoke-on-Trent
Contact:

URLs in item description get chopped - FIXED IN V3.4

Post by RWAP » Tue Sep 24, 2013 10:23 am

I noticed that some URLs in item descriptions and messages were getting chopped and no longer worked.

The issue was around instances where there were parameters.

In class\Core\Action.php find:

Code: Select all

                if(!preg_match('/^http:\/\/[\w\.\?&\=]*+$/i', $v)){ //avoid the YouTube link case
                    //Remove <a> with pure URL content (in order to avoid recursive cases for next replace)
                    // i.e. <a href="http://old.com">http://old.com</a> => http://old.com
                    $v = preg_replace('/<[^>]*a[^>]*href="[^"]+"[^>]*>(http:\/\/[\w\.\?&\=]*+)<\/a>/i',
                                        '\1', $v);
                    //Improve URL content adding the <a> link (only for cases that are not part of a href: [^"'])
                    $v = preg_replace('/([^"\'])(http:\/\/[\w\.\/\-\?&\=]*+)([^"\']|$)/i',
                                        '\1<a href="\2" class="newWindow">\2</a>\3', $v);
                }
Change this to:

Code: Select all

                if(!preg_match('/^http:\/\/[\w\.\?&;\=]*+$/i', $v)){ //avoid the YouTube link case
                    //Remove <a> with pure URL content (in order to avoid recursive cases for next replace)
                    // i.e. <a href="http://old.com">http://old.com</a> => http://old.com
                    $v = preg_replace('/<[^>]*a[^>]*href="[^"]+"[^>]*>(http:\/\/[\w\.\?&;\=]*+)<\/a>/i',
                                        '\1', $v);
                    //Improve URL content adding the <a> link (only for cases that are not part of a href: [^"'])
                    $v = preg_replace('/([^"\'])(http:\/\/[\w\.\/\-\?&;\=]*+)([^"\']|$)/i',
                                        '\1<a href="\2" class="newWindow">\2</a>\3', $v);
                }

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest