Explorar o código

Better ID validation check within the GFF3 loader

Risharde Ramnath %!s(int64=4) %!d(string=hai) anos
pai
achega
49651d6c8a
Modificáronse 1 ficheiros con 5 adicións e 5 borrados
  1. 5 5
      tripal_chado/includes/TripalImporter/GFF3Importer.inc

+ 5 - 5
tripal_chado/includes/TripalImporter/GFF3Importer.inc

@@ -2765,11 +2765,11 @@ class GFF3Importer extends TripalImporter {
     }
     else {
       $uniquename = $attrs['ID'][0];
-      if(preg_match('[\s]', $uniquename) == 1) {
-        throw new Exception(t("ID !uniquename has one or more unescaped whitespaces", ['!uniquename' => $uniquename]));
-      }
-      if(substr($uniquename, 0, 1) == ">") {
-        throw new Exception(t("ID !uniquename should not begin with a right arrow >", ['!uniquename' => $uniquename]));
+      preg_match('[a-zA-Z0-9.:^*$@!+_?-|]', $uniquename, $matches);
+      if($matches[0] != $uniquename) {
+        throw new Exception(t("ID !uniquename contains invalid characters. Only 
+          characters included in this regular expression is allowed 
+          [a-zA-Z0-9.:^*$@!+_?-|]", ['!uniquename' => $uniquename]));
       }
       $name = $attrs['Name'][0];
     }