Browse Source

Added a case-insenstive match for content types in WS

Stephen Ficklin 6 years ago
parent
commit
aae870edd9
1 changed files with 5 additions and 1 deletions
  1. 5 1
      tripal_ws/includes/TripalWebService/TripalContentService_v0_1.inc

+ 5 - 1
tripal_ws/includes/TripalWebService/TripalContentService_v0_1.inc

@@ -68,10 +68,14 @@ class TripalContentService_v0_1 extends TripalWebService {
       $ctype_lookup = array();
       $found = FALSE;
       while ($bundle = $bundles->fetchObject()) {
-        if ($ctype == preg_replace('/[^\w]/', '_', $bundle->label)) {
+        // Check the label by replacing non alpha-numeric characters with 
+        // an underscore and is case-insensitive
+        $label = preg_replace('/[^\w]/', '_', $bundle->label);
+        if (preg_match("/$label/i", $ctype)) {
           $ctype = $bundle->label;
           $found = TRUE;
         }
+        // Check if this is an accession.
         if ($ctype == $bundle->vocabulary . ':' . $bundle->accession) {
           $ctype = $bundle->label;
           $found = TRUE;