Auto_link bug |
[eluser]Iverson[/eluser]
When entering a string with web address following by a comma, such as "If you type www.example.com, you'll see what I mean!" it will return Quote:"If you type <a href="http://www.example.com,">http://www.example.com,</a> you'll see what I mean!"
[eluser]xwero[/eluser]
You can't be certain a comma in the end of an url means the url ended, some sites use them. I think it's not a bug because it can't be avoided. Every parser will have his weak points.
[eluser]Iverson[/eluser]
[quote author="xwero" date="1237836764"]You can't be certain a comma in the end of an url means the url ended, some sites use them. I think it's not a bug because it can't be avoided. Every parser will have his weak points.[/quote] Agreed but if there isn't anything after the comma, the parser doesn't need to include it. Consider the fact that all major browsers append a trailing slash after a given url ("www.example.com" becomes "http://www.example.com/"). Ergo the parser returns a hyperlink that ends in ",/". It isn't a weakness because any commas from a site will be after the first trailing slash. Any comma before the first trailing slash is invalid 100% of the time thus should be taken into consideration in the regex. I'm in no way claiming to know the proper regex but I can't concede the fact that this isn't something that can be checked every time.
[eluser]xwero[/eluser]
I've never seen a browser to append a forward slash at the end of an url? But you are right a comma can't be added to a host name but then the code needs to be changed a lot. This is what works with a few tests i did. Code: foreach($matches[0] as $i=>$match)
[eluser]Iverson[/eluser]
[quote author="xwero" date="1237844990"]I've never seen a browser to append a forward slash at the end of an url?[/quote] Thanks. Try simply typing "www.codeigniter.com" into your browser. You'll see the site and the address bar will read "http://www.codeigniter.com". Then type "www.codeigniter.com," and see whatcha get :bug:
[eluser]xwero[/eluser]
that is a first for me, but i never typed urls with comma before
[eluser]Iverson[/eluser]
[quote author="xwero" date="1237847613"]that is a first for me, but i never typed urls with comma before [/quote] Me neither. I'm buidling a site that will accept a user's comments. I did exactly like in the example: Quote:If you look at www.codeigniter.com, you'll see an example of ExpressionEngine That's where the most popular situation will be. That is, if people exercise good grammar like I do :lol:
[eluser]Iverson[/eluser]
FYI, I just tried the same sentence in Gmail, and it parsed it right. Maybe we should ask them
[eluser]xwero[/eluser]
I changed the host part line because it was removing the comma without preserving it, now it preserves the comma to add after the anchor tag.
[eluser]sophistry[/eluser]
hey guys, looking over this old thread... thought I'd link you to my fix: http://ellislab.com/forums/viewthread/95384/P15/ it fixes this 'comma at the end of the url' bug in auto-link as well as others - like auto_link() can find www.codeigniter.com, but not wiki.codeigniter.com |
Welcome Guest, Not a member yet? Register Sign In |