979a6409ad7d171eeb48d44b5a0d2cba0d304059 hiram Thu Jun 27 13:43:01 2019 -0700 checking for supported table and avoid container tracks on requests refs #23589 diff --git src/hg/hubApi/list.c src/hg/hubApi/list.c index 37e2bce..fb53e03 100644 --- src/hg/hubApi/list.c +++ src/hg/hubApi/list.c @@ -197,30 +197,38 @@ } static char *validChromName(struct sqlConnection *conn, char *db, char *table, char **splitTableName, struct hTableInfo **tableInfo) /* determine what the 'chrom' name should be for this table (aka track) * this function could be used in getData() also TBD */ { static char *returnChrom = NULL; /* to be determined if this table name is used or is some other name */ char *sqlTableName = cloneString(table); /* 'track' name in trackDb usually refers to a SQL 'table' */ struct trackDb *tdb = obtainTdb(NULL, db); struct trackDb *thisTrack = findTrackDb(table,tdb); + +/* thisTrack can be NULL at this time, taken care of later */ + +if (thisTrack && (tdbIsComposite(thisTrack) || tdbIsCompositeView(thisTrack))) + apiErrAbort(err400, err400Msg, "container track '%s' does not contain data, use the children of this container for data access", table); +if (thisTrack && ! isSupportedType(thisTrack->type)) + apiErrAbort(err415, err415Msg, "track type '%s' for track=%s not supported at this time", thisTrack->type, table); + /* however, the trackDb might have a specific table defined instead */ char *tableName = trackDbSetting(thisTrack, "table"); if (isNotEmpty(tableName)) { freeMem(sqlTableName); sqlTableName = cloneString(tableName); } /* this function knows how to deal with split chromosomes, the NULL * here for the chrom name means to use the first chrom name in chromInfo */ struct hTableInfo *hti = hFindTableInfoWithConn(conn, NULL, sqlTableName); *tableInfo = hti; /* returning to caller */ /* check if table name needs to be modified */ if (hti && hti->isSplit)