1925f0952661720e21caf1b7dbbea3db820b6610 chmalee Thu Mar 26 10:31:52 2020 -0700 Fixing hubCheck htmlOut issue when a hub is missing a shortLabel, refs 24559 note 56 diff --git src/hg/utils/hubCheck/hubCheck.c src/hg/utils/hubCheck/hubCheck.c index 9d3db63..38291b4 100644 --- src/hg/utils/hubCheck/hubCheck.c +++ src/hg/utils/hubCheck/hubCheck.c @@ -923,38 +923,56 @@ // use netUrlHead too. We still want udcExists so if a file is a local file we // can still find it char *descUrl = hub->descriptionUrl; if (descUrl == NULL) warn("warning: missing hub overview descripton page (descriptionUrl setting)"); else if ((!hasProtocol(descUrl) && !udcExists(descUrl)) || netUrlHead(descUrl, NULL) < 0) warn("warning: %s descriptionUrl setting does not exist", hub->descriptionUrl); } errCatchEnd(errCatch); if (errCatch->gotError || errCatch->gotWarning) { retVal = 1; hubErr(hubErrors, errCatch->message->string, hub, options->htmlOut); if (options->htmlOut) - dyStringPrintf(errors, "trackData['#'] = [%s,", + { + if (hub && hub->shortLabel) + { + dyStringPrintf(errors, "trackData['#'] = [%s", makeFolderObjectString(hub->shortLabel, "Hub Errors", "#", "Click to open node", TRUE, TRUE)); } + else + { + dyStringPrintf(errors, "trackData['#'] = [%s", + makeFolderObjectString("Hub Error", "Hub Errors", "#", + "Click to open node", TRUE, TRUE)); + } + } + } errCatchFree(&errCatch); if (hub == NULL) { + // the reason we couldn't close the array in the previous block is because + // there may be non-fatal errors and we still want to keep trying to check + // the genomes settings, which need to be children of the root '#' node. + // Here we are at a fatal error so we can close the array and return + if (options->htmlOut) + dyStringPrintf(errors, "];\n%s", dyStringCannibalize(&hubErrors)); + else dyStringPrintf(errors, "%s", dyStringCannibalize(&hubErrors)); return 1; } if (options->htmlOut && retVal != 1) dyStringPrintf(errors, "trackData['#'] = ["); if (options->checkSettings) retVal |= hubSettingsCheckInit(hub, options, errors); struct trackHubGenome *genome; int numGenomeErrors = 0; char genomeTitleString[128]; struct dyString *genomeErrors = dyStringNew(0); for (genome = hub->genomeList; genome != NULL; genome = genome->next) {