Index: modules/hs_taxonomy.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/hierarchical_select/modules/hs_taxonomy.module,v
retrieving revision 1.54
diff -u -p -r1.54 hs_taxonomy.module
--- modules/hs_taxonomy.module	6 Sep 2010 22:04:32 -0000	1.54
+++ modules/hs_taxonomy.module	15 Oct 2010 23:56:53 -0000
@@ -615,7 +615,7 @@ function hs_taxonomy_token_values($type,
       $node = $object;
 
       // Default values.
-      $values['save-lineage-termpath'] = $values['save-lineage-termpath-raw'] = FALSE;
+      $values['save-lineage-termpath'] = $values['save-lineage-termpath-raw'] = '';
 
       // If $node->taxonomy doesn't exist, these tokens cannot be created!
       if (!is_object($node) || !isset($node->taxonomy) || !is_array($node->taxonomy)) {
@@ -650,8 +650,10 @@ function hs_taxonomy_token_values($type,
           $terms = _hs_taxonomy_token_termpath_for_vid($selection, $vid);
         }
 
-        $values["save-lineage-termpath:$vid"] = implode($separator, array_map('check_plain', $terms));
-        $values["save-lineage-termpath-raw:$vid"] = implode($separator, $terms);
+        $terms_raw = $terms;
+        $terms = array_map('check_plain', $terms);
+        $values["save-lineage-termpath:$vid"] = !empty($options['pathauto']) ? $terms : implode($separator, $terms);
+        $values["save-lineage-termpath-raw:$vid"] = !empty($options['pathauto']) ? $terms_raw : implode($separator, $terms_raw);
       }
 
       // We use the terms of the first vocabulary that uses Hierarchical
@@ -659,8 +661,8 @@ function hs_taxonomy_token_values($type,
       $vids = array_intersect(array_keys($node->taxonomy), $hs_vids);
       if (!empty($vids)) {
         $vid = $vids[0];
-        $values['save-lineage-termpath'] = implode($separator, array_map('check_plain', $terms));
-        $values['save-lineage-termpath-raw'] = implode($separator, $terms);
+        $values['save-lineage-termpath'] = !empty($options['pathauto']) ? $terms : implode($separator, $terms);
+        $values['save-lineage-termpath-raw'] = !empty($options['pathauto']) ? $terms_raw : implode($separator, $terms_raw);
       }
       break;
   }
