a04b6192ec6869a40993a00985403da5ce1c2c21 chmalee Wed Jul 24 16:43:00 2019 -0700 Fixing bug in hubClone found by Braney, refs #23850 diff --git src/hg/utils/hubClone/hubClone.c src/hg/utils/hubClone/hubClone.c index 54d55d1..0f4a762 100644 --- src/hg/utils/hubClone/hubClone.c +++ src/hg/utils/hubClone/hubClone.c @@ -78,31 +78,35 @@ sameString(hel->name, "twoBitPath") || sameString(hel->name, "htmlPath") ) fprintf(out, "%s %s\n", hel->name, trackHubRelativeUrl(baseUrl, hel->val)); else if (sameString(hel->name, "trackDb")) { if (oneFile) { fprintf(out, "%s %s\n", hel->name, (char *)hel->val); } else { // some assembly hubs use different directory names than the typical // genomeName/trackDb.txt setup, hardcode this so assembly hub will // still load locally - char *tdbFileName = strrchr((char *)hel->val, '/') + 1; + char *tdbFileName = NULL; + if ((tdbFileName = strrchr((char *)hel->val, '/')) != NULL) + tdbFileName += 1; + else + tdbFileName = (char *)hel->val; fprintf(out, "%s %s/%s\n", hel->name, genome, tdbFileName); } } else fprintf(out, "%s %s\n", hel->name, (char *)hel->val); } } fprintf(out, "\n"); hashElFreeList(&helList); } void printTrackDbStanza(struct hash *stanza, FILE *out, char *baseUrl) /* print a trackDb stanza but with relative references replaced by remote links */ { struct hashEl *hel, *helList = hashElListHash(stanza);