4bb6fa70811bad557c8f9083652cdb3597d551fd braney Wed Dec 20 10:45:16 2017 -0800 fix "name too long" bug in bigBed custom tracks loaded directly #20708 diff --git src/hg/lib/customPp.c src/hg/lib/customPp.c index cb6bde8..fc2872c 100644 --- src/hg/lib/customPp.c +++ src/hg/lib/customPp.c @@ -50,38 +50,45 @@ slFreeList(&cpp->reusedLines); freeMem(cpp->inReuse); slFreeList(&cpp->skippedLines); } } static char* bigUrlToTrackLine(char *url) /* given the URL to a big file, create a custom track * line for it, has to be freed. Return NULL * if it's not a big file URL */ { char *type = customTrackTypeFromBigFile(url); if (type==NULL) return url; -struct netParsedUrl npu; -netParseUrl(url, &npu); -char baseName[PATH_LEN]; -splitPath(npu.file, NULL, baseName, NULL); +// grab the last element in the path +char *baseName = cloneString(url); +char *ptr; +if ((ptr = strrchr(baseName, '/')) != NULL) + baseName = ptr + 1; + // For vcfTabix files that end in ".vcf.gz", only the ".gz" is stripped off by splitPath; // strip off the remaining ".vcf": if (endsWith(baseName, ".vcf")) baseName[strlen(baseName)-4] = '\0'; + +// cap track name at 100 chars for sanity's sake +if (strlen(baseName) > 100) + baseName[100] = 0; + char *trackName = baseName; char buf[4000]; safef(buf, sizeof(buf), "track name=%s bigDataUrl=%s type=%s\n", trackName, url, type); freeMem(type); return cloneString(buf); } char *customPpNext(struct customPp *cpp) /* Return next line. */ { /* Check first for line to reuse. */ struct slName *reused = cpp->reusedLines; if (reused)