Index: taxonomy.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/taxonomy.module,v
retrieving revision 1.91
diff -F^function -u -r1.91 taxonomy.module
--- taxonomy.module	29 Dec 2003 17:14:26 -0000	1.91
+++ taxonomy.module	29 Dec 2003 18:20:36 -0000
@@ -722,13 +722,24 @@ function taxonomy_nodeapi($node, $op, $a
 }
 
 function taxonomy_page() {
-
-
   // taxonomy querystring always parsed here
   // TODO: support term *names* in URL (e.g. taxonomy/view/or/milk,beer,red+wine)
   $taxonomy->operator = arg(2);
   $taxonomy->str_tids = check_query(arg(3));
   $taxonomy->tids = explode(",", $taxonomy->str_tids);
+  if (!ereg('[0-9,]', $taxonomy->str_tids)) {
+    $tids = array();
+    foreach ($taxonomy->tids as $tid) {
+      if (is_numeric($tid)) {
+        $tids[] = $tid;
+      }
+      elseif ($tid = db_result(db_query("SELECT tid FROM term_data WHERE name = '%s'", $tid))) {
+        $tids[] = $tid;
+      }
+    }
+    $taxonomy->tids = $tids;
+    $taxonomy->str_tids = implode(',', $tids);
+  }
 
   switch (arg(1)) {
     case "feed":
@@ -736,24 +747,29 @@ function taxonomy_page() {
       break;
     default:
       // Build title:
-      $sql = 'SELECT name FROM {term_data} WHERE tid IN (%s)';
-      $result = db_query($sql, $taxonomy->str_tids);
-      while ($term = db_fetch_object($result)) {
-        $names[] = $term->name;
-      }
+      if ($taxonomy->tids) {
+        $sql = 'SELECT name FROM {term_data} WHERE tid IN (%s)';
+        $result = db_query($sql, $taxonomy->str_tids);
+        while ($term = db_fetch_object($result)) {
+          $names[] = $term->name;
+        }
+
+        // Build breadcrumb based on first hierarchy of first term:
+        $current->tid = $taxonomy->tids[0];
+        while ($parents = taxonomy_get_parents($current->tid)) {
+          $current = array_shift($parents);
+          $breadcrumbs[] = l($current->name, "taxonomy/view/or/$current->tid");
+        }
+        $breadcrumbs[] = l(t('Home'), '');
+        $breadcrumbs = array_reverse($breadcrumbs);
 
-      // Build breadcrumb based on first hierarchy of first term:
-      $current->tid = $taxonomy->tids[0];
-      while ($parents = taxonomy_get_parents($current->tid)) {
-        $current = array_shift($parents);
-        $breadcrumbs[] = l($current->name, "taxonomy/view/or/$current->tid");
+        $output = taxonomy_render_nodes(taxonomy_select_nodes($taxonomy));
+        print theme("page", $output, implode(', ', $names), $breadcrumbs);
+        break;
+      }
+      else {
+        drupal_not_found();
       }
-      $breadcrumbs[] = l(t('Home'), '');
-      $breadcrumbs = array_reverse($breadcrumbs);
-
-      $output = taxonomy_render_nodes(taxonomy_select_nodes($taxonomy));
-      print theme("page", $output, implode(', ', $names), $breadcrumbs);
-      break;
   }
 }
 
