? patches
Index: pathauto.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/pathauto/pathauto.inc,v
retrieving revision 1.56.2.37
diff -u -p -r1.56.2.37 pathauto.inc
--- pathauto.inc	24 Sep 2010 22:35:50 -0000	1.56.2.37
+++ pathauto.inc	25 Sep 2010 14:27:43 -0000
@@ -632,9 +632,10 @@ function _pathauto_verbose($message = NU
  *   Pathauto expects to see them.
  */
 function pathauto_get_placeholders($type, $object) {
-  $full = token_get_values($type, $object, TRUE, array('pathauto' => TRUE));
+  $options = array('pathauto' => TRUE);
+  $full = token_get_values($type, $object, TRUE, $options);
   $tokens = token_prepare_tokens($full->tokens);
-  $values = pathauto_clean_token_values($full);
+  $values = pathauto_clean_token_values($full, $options);
   return array('tokens' => $tokens, 'values' => $values);
 }
 
@@ -648,26 +649,25 @@ function pathauto_get_placeholders($type
  * @return
  *   An array of the cleaned tokens.
  */
-function pathauto_clean_token_values($full) {
+function pathauto_clean_token_values($full, $options = array()) {
   $replacements = array();
   foreach ($full->values as $key => $value) {
-    // Only clean non-path tokens.
     $token = $full->tokens[$key];
-    if (strpos($token, 'path') !== FALSE && is_array($value)) {
-      // The token value is an array if we specified $options['pathauto'] = TRUE,
-      // then we should assume this is a 'segment' URL that should be pieced back
-      // together.
+    if (strpos($token, 'path') !== FALSE && is_array($value) && !empty($options['pathauto'])) {
+      // If the token name contains 'path', the token value is an array, and
+      // the 'pathauto' option was passed to token_get_values(), then the token
+      // should have each segment cleaned, and then glued back together to
+      // construct an value resembling an URL.
       $segments = array_map('pathauto_cleanstring', $value);
       $replacements[$token] = implode('/', $segments);
     }
-    elseif (!preg_match('/(path|alias|url|url-brief)(-raw)?$/', $token)) {
-      // Tokens that do not match URL-type names should still have their values
-      // cleaned.
-      $replacements[$token] = pathauto_cleanstring($value);
+    elseif (preg_match('/(path|alias|url|url-brief)(-raw)?$/', $token)) {
+      // Token name matches an URL-type name and should be left raw.
+      $replacements[$token] = $value;
     }
     else {
-      // The token must be an URL or alias token that should not be left raw.
-      $replacements[$token] = $value;
+      // Tokens is not an URL, so it should have its value cleaned.
+      $replacements[$token] = pathauto_cleanstring($value);
     }
   }
   return $replacements;
Index: pathauto.tokens.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/pathauto/Attic/pathauto.tokens.inc,v
retrieving revision 1.1.2.11
diff -u -p -r1.1.2.11 pathauto.tokens.inc
--- pathauto.tokens.inc	24 Sep 2010 22:35:50 -0000	1.1.2.11
+++ pathauto.tokens.inc	25 Sep 2010 14:27:43 -0000
@@ -89,7 +89,7 @@ function _pathauto_token_values($type, $
           array_unshift($catpath, check_plain($parent->name));
           array_unshift($catpath_raw, $parent->name);
         }
-        
+
         $values[$label . 'path'] = !empty($options['pathauto']) ? $catpath : implode('/', $catpath);
         $values[$label . 'path-raw'] = !empty($options['pathauto']) ? $catpath_raw : implode('/', $catpath_raw);
 
