eb2780907d717a7cf8e2a34cd79276512c3880dc chmalee Fri May 2 11:59:49 2025 -0700 Oops when a user was uploading a hub.txt file to hubspace that was not named 'hub.txt', we were doing dumb stuff. Also fix more issues with the hubspace data dir being a symlink, refs #35384 diff --git src/hg/js/hgMyData.js src/hg/js/hgMyData.js index 0a0079e12ac..daf07739c16 100644 --- src/hg/js/hgMyData.js +++ src/hg/js/hgMyData.js @@ -348,52 +348,53 @@ // the data this function is using let selectedData = {}; function viewAllInGenomeBrowser(ev) { // redirect to hgTracks with these tracks/hubs open let data = selectedData; if (typeof uiState.userUrl !== "undefined" && uiState.userUrl.length > 0) { let url = "../cgi-bin/hgTracks?hgsid=" + getHgsid(); let genome; // may be multiple genomes in list, just redirect to the first one // TODO: this should probably raise an alert to click through let hubsAdded = {}; _.forEach(data, (d) => { if (!genome) { genome = d.genome; url += "&db=" + genome; } - if (d.fileType in extensionMap) { + if (d.fileType === "hub.txt") { + url += "&hubUrl=" + uiState.userUrl + encodeURIComponent(d.fullPath); + } + else if (d.fileType in extensionMap) { // TODO: tusd should return this location in it's response after // uploading a file and then we can look it up somehow, the cgi can // write the links directly into the html directly for prev uploaded files maybe? if (!(d.parentDir in hubsAdded)) { // NOTE: hubUrls get added regardless of whether they are on this assembly // or not, because multiple genomes may have been requested. If this user // switches to another genome we want this hub to be connected already url += "&hubUrl=" + uiState.userUrl + cgiEncode(d.parentDir); if (d.parentDir.endsWith("/")) { url += "hub.txt"; } else { url += "/hub.txt"; } } hubsAdded[d.parentDir] = true; if (d.genome == genome) { // turn the track on if its for this db url += "&" + trackHubFixName(d.fileName) + "=pack"; } - } else if (d.fileType === "hub.txt") { - url += "&hubUrl=" + uiState.userUrl + d.fullPath; } }); window.location.assign(url); return false; } } function deleteFileSuccess(jqXhr, textStatus) { deleteFileFromTable(jqXhr.deletedList); updateSelectedFileDiv(null); } function deleteFileList(ev) { // same as deleteFile() but acts on the selectedData variable let data = selectedData; @@ -1388,31 +1389,31 @@ let newReqObj, hubTxtObj, parentDirObj; newReqObj = { "fileName": cgiEncode(metadata.fileName), "fileSize": metadata.fileSize, "fileType": metadata.fileType, "genome": metadata.genome, "parentDir": cgiEncode(metadata.parentDir), "lastModified": dFormatted, "uploadTime": nowFormatted, "fullPath": cgiEncode(metadata.parentDir) + "/" + cgiEncode(metadata.fileName), }; // from what I can tell, any response we would create in the pre-finish hook // is completely ignored for some reason, so we have to fake the other files // we would have created with this one file and add them to the table if they // weren't already there: - if (metadata.fileName !== "hub.txt") { + if (metadata.fileType !== "hub.txt") { // if the user uploaded a hub.txt don't make a second fake object for it hubTxtObj = { "uploadTime": nowFormatted, "lastModified": dFormatted, "fileName": "hub.txt", "fileSize": 0, "fileType": "hub.txt", "genome": metadata.genome, "parentDir": cgiEncode(metadata.parentDir), "fullPath": cgiEncode(metadata.parentDir) + "/hub.txt", }; } parentDirObj = { "uploadTime": nowFormatted, "lastModified": dFormatted,