654a32057db1b51cde7b9aa0db0f34b3cbc8c0bf galt Sat Jan 22 03:29:27 2011 -0800 fixing bugs with handling of htmlFile; and bouncing unacceptable changes rather than saving them even when they are bad diff --git src/hg/lib/customTrack.c src/hg/lib/customTrack.c index ec292dd..0cc5d5b 100644 --- src/hg/lib/customTrack.c +++ src/hg/lib/customTrack.c @@ -558,31 +558,31 @@ /* HACK ALERT - calling private method function in customFactory.c */ track->maxChromName = hGetMinIndexLength(genomeDb); /* for the loaders */ wigLoaderEncoding(track, track->wigAscii, ctDbUseAll()); ctAddToSettings(track, "tdbType", track->tdb->type); ctAddToSettings(track, "wibFile", track->wibFile); } /* handle track description */ if (isNotEmpty(track->tdb->html)) { /* write doc file in trash and add reference to the track line*/ if (!track->htmlFile) { static struct tempName tn; trashDirFile(&tn, "ct", CT_PREFIX, ".html"); - track->htmlFile = tn.forCgi; + track->htmlFile = cloneString(tn.forCgi); } writeGulp(track->htmlFile, track->tdb->html, strlen(track->tdb->html)); ctAddToSettings(track, "htmlFile", track->htmlFile); } else { track->htmlFile = NULL; ctRemoveFromSettings(track, "htmlFile"); } saveTdbLine(f, fileName, track->tdb); if (!track->dbTrack) { struct bed *bed; for (bed = track->bedList; bed != NULL; bed = bed->next) @@ -746,31 +746,32 @@ html = customDocParse(html); /* this will chew up the input string */ if(html != NULL) { char *tmp = html; html = jsStripJavascript(html); freeMem(tmp); } if ((strlen(html) > 50*1024) || startsWith("track ", html) || startsWith("browser ", html)) { err = cloneString( "Optional track documentation appears to be either too large (greater than 50k) or it starts with a track or browser line. " "This is usually an indication that the data has been accidentally put into the documentation field. " "Only html documentation is intended for this field. " "Please correct and re-submit."); - customText = NULL; + html = NULL; /* we do not want to save this bad value */ + customText = NULL; /* trigger a return to the edit page */ } struct customTrack *newCts = NULL, *ct = NULL; if (isNotEmpty(customText)) { /* protect against format errors in input from user */ struct errCatch *errCatch = errCatchNew(); if (errCatchStart(errCatch)) { newCts = customFactoryParse(genomeDb, customText, FALSE, &browserLines); if (html) { for (ct = newCts; ct != NULL; ct = ct->next) if (!ctHtmlUrl(ct)) ct->tdb->html = cloneString(html);