Commit b3dae716 authored by Dries's avatar Dries

- Patch #98293 by Steven: remove restrictions on path aliases.

parent 8996aad9
......@@ -702,6 +702,9 @@ function valid_email_address($mail) {
/**
* Verify the syntax of the given URL.
*
* This function should only be used on actual URLs. It should not be used for
* Drupal menu paths, which can contain arbitrary characters.
*
* @param $url
* The URL to verify.
* @param $absolute
......
......@@ -224,10 +224,7 @@ function path_nodeapi(&$node, $op, $arg) {
switch ($op) {
case 'validate':
$node->path = trim($node->path);
if ($node->path && !valid_url($node->path)) {
form_set_error('path', t('The path is invalid.'));
}
else if (db_result(db_query("SELECT COUNT(dst) FROM {url_alias} WHERE dst = '%s' AND src != '%s'", $node->path, "node/$node->nid"))) {
if (db_result(db_query("SELECT COUNT(dst) FROM {url_alias} WHERE dst = '%s' AND src != '%s'", $node->path, "node/$node->nid"))) {
form_set_error('path', t('The path is already in use.'));
}
break;
......@@ -345,14 +342,6 @@ function path_form_validate($form_id, $form_values) {
$dst = $form_values['dst'];
$pid = $form_values['pid'];
if (!valid_url($src)) {
form_set_error('src', t('The system path %path is invalid.', array('%path' => $src)));
}
if (!valid_url($dst)) {
form_set_error('dst', t('The alias %alias is invalid.', array('%alias' => $dst)));
}
if (db_result(db_query("SELECT COUNT(dst) FROM {url_alias} WHERE pid != %d AND dst = '%s'", $pid, $dst))) {
form_set_error('dst', t('The alias %alias is already in use.', array('%alias' => $dst)));
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment