Skip to content

Commit 0b52b23

Browse files
committed
Fix JS update of download links
1 parent 66653be commit 0b52b23

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

idr_gallery/templates/idr_gallery/archived_image.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,12 +149,13 @@ <h3>Download Image Files</h3>
149149
}
150150
const baseUrl = downloadUrl.split(IDR_ID)[0]; // e.g. https://ftp.ebi.ac.uk/pub/databases/IDR/
151151
console.log(`Download URL for ${IDR_ID}:`, downloadUrl);
152-
if (downloadUrl) {
152+
if (downloadUrl && downloadUrl !== DOWNLOAD_URL) {
153+
console.log(`Updating download URLs from ${DOWNLOAD_URL} to ${downloadUrl}`);
153154
// update all ".file_download" links to this download URL
154155
const fileDownloadLinks =
155156
document.querySelectorAll(".file_download");
156157
fileDownloadLinks.forEach((link) => {
157-
link.href = link.href.replace(DOWNLOAD_URL, baseUrl);
158+
link.href = link.href.replace(DOWNLOAD_URL, downloadUrl);
158159
});
159160
}
160161
} else {

idr_gallery/views.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -586,7 +586,7 @@ def image_viewer(request, iid, conn=None, **kwargs):
586586
if idrid in path:
587587
# we want path *after* /idr0002-heriche-condensation/
588588
# split on idrid handles mismatch like idr0047-neuert-yeastmrna with path idr0047-neuert-yeastmRNA
589-
file_path = path.split(idrid_name, 1)[-1]
589+
file_path = path.split(idrid, 1)[-1]
590590
# remove before first "/" if present
591591
file_path = file_path.split("/", 1)[-1] if "/" in file_path else file_path
592592
if data_location == "Github":

0 commit comments

Comments
 (0)