4

My recent comment with text

@Chris: Oh. I didn't even consider this. Still, this links isn't in google nor I can find it via [internal search](http://stackoverflow.com/search?q=url%3A%22http%3A%2F%2Fstackoverflow.com%2Fq%2F25433%2F*%22&submit=search)

Had to offer link to search url:"http://stackoverflow.com/q/25433/*". However, that star was removed in url, so from (removed Stack Overflow url)

/search?q=url%3A%22http%3A%2F%2Fstackoverflow.com%2Fq%2F25433%2F*%22&submit=search

I got

/search?q=url%3A%22http%3A%2F%2Fstackoverflow.com%2Fq%2F25433%2F%22&submit=search

instead, without that start, it's also visible in source code

<a href="http://stackoverflow.com/search?q=url%3A%22http%3A%2F%2Fstackoverflow.com%2Fq%2F25433%2F%22&amp;submit=search">internal search</a>
  • You can also see the problem here – genesis Oct 7 '11 at 21:35
6

An asterisk is not in the sanitizer's character whitelist for URLs, so it will be removed. You have to UrlEncode it as %2a.

From the next build on, the star will not be removed, but encoded, and thus the link will work fine.

See this answer of mine for details.

  • 1
    Any chance the search could encode that in its URL too? – Arjan Oct 7 '11 at 22:06
  • @Arjan - that would be a reasonable work-around for: meta.stackexchange.com/questions/108466/… too – Flexo Oct 8 '11 at 17:08
  • Note that this actually works for Markdown URLs in regular posts (where the * is encoded to become %2a), but not for Markdown URLs in comments. Is that the expected behavior? – Arjan Dec 11 '11 at 13:03
  • As for search: the URL in the location bar after submitting a search for url:"http://stackoverflow.com/a/*" does not encode the asterisk, but yields q=url%3A%22http%3A%2F%2Fstackoverflow.com%2Fa%2F*%22. Hence, it cannot be used in comments like so, but only when manually encoding the asterisk first, like so. It would be nice if the search encoded for us... :-) – Arjan Dec 11 '11 at 13:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .