Attached is a patch to allow exclamation marks in a URL. According to RFC 1738, it appears to be a valid character:

Thus, only alphanumerics, the special characters "$-_.+!*'(),", and reserved characters used for their reserved purposes may be used unencoded within a URL.

Example valid URL: http://www.cinemanow.com/Buy/Movies/1007,0,5,,1,2,0/1001,0,5,,1,2,335666...

Comments

westbywest’s picture

Bump.

I got caught with this bug in CCK link module v5.x-2.5.

Example valid URL with exclamation:
http://www.usda.gov/wps/portal/!ut/p/_s.7_0_A/7_0_2KD?contentidonly=true...

jcfiala’s picture

Okay, I've fixed this for the next release of 6.x - but will need to also fix it in 5, I see.

Thanks for the example urls, folks.

vgarvardt’s picture

StatusFileSize
new513 bytes

Issue found in 6.x-2.6-beta1

Here is one more patch, to allow exclamation in query, to validate the following url: http://www.orbitz.com/App/PerformMDLPDealsContent?OSC=KPpjTzSlU0!-109580...

vgarvardt’s picture

And one more character that should be allowed in query is ^

Valid URL example is http://clk.tradedoubler.com/click?p=60261&a=1741603&g=17066602&url=http:...|UK|TD|??|^^|&utm_source=TradeDoubler&utm_medium=Affiliate&utm_campaign=TradeDoubler&utm_term=&utm_content=

marcvangend’s picture

Status: Needs review » Needs work

In addition, exclamation marks are also allowed in the anchor. Both Twitter and Facebook use url's like http://twitter.com/#!/marcvangend nowadays. In other words, this should be added to the patch:

--- link.module
+++ link.module
@@ -867,7 +867,7 @@
   $directories = "(\/[a-z0-9". $LINK_ICHARS ."_\-\.~+%=&,$'!():;*@\[\]]*)*";
   // Yes, four backslashes == a single backslash.
   $query = "(\/?\?([?a-z0-9". $LINK_ICHARS ."+_|\-\.\/\\\\%=&,$'():;*@\[\]{} ]*))";
-  $anchor = "(#[a-z0-9". $LINK_ICHARS ."_\-\.~+%=&,$'():;*@\[\]\/\?]*)";
+  $anchor = "(#[a-z0-9". $LINK_ICHARS ."_\-\.~+%=&,$'!():;*@\[\]\/\?]*)";
 
   // The rest of the path for a standard URL.
   $end = $directories .'?'. $query .'?'. $anchor .'?'.'$/i';

stuart.crouch’s picture

We've just discovered this limitation when trying to make use of the oEmbed module for our embed server. The embed server uses the #! notation in the same format as twitter, so I'm wondering how I can help get this implemented.

jasonawant’s picture

Status: Needs work » Closed (duplicate)