Hashmark in links produces wrong links
Coornail - August 10, 2009 - 11:44
| Project: | Activity Stream |
| Version: | 6.x-2.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
Description
If you write links that has hashmarks in it, the activitystream_twitter_makelinks() produces links that has an tag in an another tag.
The error is in the activitystream_twitter_makelinks() function at the 81th line:
$text = preg_replace('/#(\w*)/', '<a href="http://hashtags.org/tag/\\1/">#\\1</a>', $text);http://example.com/#lolwill become
<a href="http://example.com/#lol">http://example.com/<a href="http://hashtags.org/tag/#lol>#lol</a></a>
#1
I think the only proper way to handle this would be to only link a hashtag if it is preceded by whitespace or begins the string. This will mean that if someone were to say #hash#tag without a space separating them then only #hash would get linked and #tag would be ignored. I cant imagine that this is a common case.
Fixed in CVS rev 1.2.2.5.
This fix is going into 2.x only.
#2
Automatically closed -- issue fixed for 2 weeks with no activity.