Hi - found an issue with the module, I'm on 6.x-1.2.

Let's say there is a twitter post as follows:

Hey look at this website: http://website.com/foo.

There is a period at the end of the sentence, but it isn't part of the actual URL. What is happening is that when this is rendered via twitter_pull, it shows up as this:

website.com/foo.

I.E. it is adding the period on to the end, which is incorrect and results in a 404 when you click the link.

CommentFileSizeAuthor
#5 twitter_pull_url.patch566 bytesmrryanjohnston

Comments

rjbrown99’s picture

Crap, I needed code blocks. Let's try again.

<a href="http://website.com/foo.">website.com/foo.</a>
mnlund’s picture

We had the same problem, and fixed it by using the pattern from the url filter in drupal instead.

We replaced line 127 and 128 with the following code:

$pattern = '`(<p>|<li>|<br\s*/?>|[ \n\r\t\(])((http://|https://|ftp://|mailto:|smb://|afp://|file://|gopher://|news://|ssl://|sslv2://|sslv3://|tls://|tcp://|udp://)([a-zA-Z0-9@:%_+*~#?&=.,/;-]*[a-zA-Z0-9@:%_+*~#&=/;-]))([.,?!]*?)(?=(</p>|</li>|<br\s*/?>|[ \n\r\t\)]))`i';
$repl = '$1<a href="$2" rel="nofollow" title="$2">$2</a>$5';

We can make a patch for this if it's needed.

gnosis’s picture

For the same problem in v7.x, I did similar to #2, but cut out the middleman completely and used the core function inside of twitter_pull_add_links():

// Use the core url filter to parse for standard URLs
if (module_exists('filter')) {
  $filter = new stdClass(); // dummy filter object
  $filter->settings = array('filter_url_length' => 496);
  $text = _filter_url($text, $filter);
}

It's not technically necessary to check for the filter module, as it's required by core, but I threw it in out of habit. Never trust another module to exist, I always say.

mrryanjohnston’s picture

Are there plans to roll this into this module yet? I feel as though this is a pretty big outstanding flaw. #3 worked a charm for me, by the way.

mrryanjohnston’s picture

StatusFileSize
new566 bytes

Made this into a patch.

EDIT: see my next post

mrryanjohnston’s picture

Updated patch and separate issue for the d7 version: #1416776: Better Email/username/url linking.