- Patch #18437 by Mathias: Drupal doesn't allow URL aliases that map to Userland Manila posts since they usually contain the '$' and are considered an invalid URL. This patch allows '$' in an URL and thus an alias. It also resolves a disparity between the 'allowable characters' of absolute and relative URLs. As far as I can tell, those parts of the regexp should be the same.
parent
344f33f6af
commit
42a085c8ad
|
@ -596,11 +596,12 @@ function valid_email_address($mail) {
|
|||
* TRUE if the URL is in a valid format.
|
||||
*/
|
||||
function valid_url($url, $absolute = FALSE) {
|
||||
$allowed_characters = '[a-z0-9\/:_\-_\.\?\$,~=#&%\+]';
|
||||
if ($absolute) {
|
||||
return preg_match("/^(http|https|ftp):\/\/[a-z0-9\/:_\-_\.\?,~=#&%\+]+$/i", $url);
|
||||
return preg_match("/^(http|https|ftp):\/\/". $allowed_characters ."+$/i", $url);
|
||||
}
|
||||
else {
|
||||
return preg_match("/^[a-z0-9\/:_\-_\.,\+]+$/i", $url);
|
||||
return preg_match("/^". $allowed_characters ."+$/i", $url);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue