Fixed  Trailing white-space breaks the URLs

Shadab

Well-known member
Sample bbcode:
Code:
[url]http://www.xenforo.com [/url]


On First Save:

ie, on creation of a thread/post or when you insert a new link in an existing post,
it gets POSTed as:
Code:
<p>[url]http://www.xenforo.com [/url]</p>

which is rendered on the thread page just fine, since the browser (Firefox 3.6.8 in my case) ignores the trailing whitespace in the href attribute.
Code:
<a class="externalLink" target="_blank" href="http://www.xenforo.com ">http://www.xenforo.com </a>


On Subsequent Saves:

ie, when you edit and save a post which contains such a link,
it gets POSTed as:
Code:
<p><a href="http://www.xenforo.com%20" _mce_href="http://www.xenforo.com " target="_blank" [...]

which is rendered as a broken link on the thread page, since the browser won't ignore encoded trailing spaces.
Code:
<a class="externalLink" target="_blank" href="http://www.xenforo.com%20">http://www.xenforo.com </a>


See it in action here:
On a sidenote; this also happens when you enter a URL with trailing space(s) via the "Insert/edit link" button in the rich-text editor.
 
Top Bottom