33ff7f177b5641cd9aebb684a057a84b08920d8c galt Sun May 12 11:52:14 2019 -0700 It makes sense to treat the missing accession id like a 404 for downloads via cdwGetFile diff --git src/hg/cirm/cdw/cdwGetFile/cdwGetFile.c src/hg/cirm/cdw/cdwGetFile/cdwGetFile.c index b360cc1..c08a9d4 100644 --- src/hg/cirm/cdw/cdwGetFile/cdwGetFile.c +++ src/hg/cirm/cdw/cdwGetFile/cdwGetFile.c @@ -177,31 +177,31 @@ printf("Content-Length: %lld\n", (long long)fileSize(filePath)); printf("X-Sendfile: %s\n\n", filePath); } void sendFileByAcc(struct sqlConnection *conn, char* acc, boolean useSubmitFname, char *addExt) /* send file identified by acc (=cdwValidFile.licensePlate), suggests a canonical filename of the format * <licensePlate>.<originalExtension> * Example URL: http://hgwdev.soe.ucsc.edu/cgi-bin/cdwGetFile?acc=SCH000FSW * * if useSubmitFname is TRUE, suggest the submission filename, not a canonical name. * if addExt is not NULL, will not retrieve the file identified by accession but rather its index file, * with the given extension (.tbi or .bai) */ { struct cdwValidFile *vf = cdwValidFileFromLicensePlate(conn, acc); if (vf==NULL) - errExit("%s is not a valid accession in the CDW.", acc); + errExitExt("%s is not a valid accession in the CDW.", acc, "404 Not Found"); struct cdwFile *ef = cdwFileFromId(conn, vf->fileId); char* filePath = cdwPathForFileId(conn, vf->fileId); if (addExt != NULL) { if (! (sameWord(addExt, ".bai") || sameWord(addExt, ".tbi"))) errAbort("ERROR: The addExt argument to cdwGetFile can only be .bai or .tbi. No other values are allowed."); if ((endsWith(filePath, ".vcf") || endsWith(filePath, ".VCF")) && sameWord(addExt, ".tbi")) // the .tbi files of .vcf files are actually named .vcf.gz.tbi filePath = catTwoStrings(filePath, ".gz.tbi"); else filePath = catTwoStrings(filePath, addExt); }