From e2db71192e1d5366db4c280e4471f3126ed8a726 Mon Sep 17 00:00:00 2001 From: Anjo Vahldiek-Oberwagner Date: Sat, 16 May 2026 00:51:04 +0200 Subject: [PATCH] fix: case-insensitive artifact URL lookup and normalize bare DOI links - Profile page: use lowercase keys in artifactUrlMap so paper titles with different casing (e.g. EuroSys 2021/2022) still resolve to artifact URLs - Search & profile pages: add normalizeUrl() to prepend https://doi.org/ to bare DOI strings (e.g. '10.5281/zenodo.6337102') used as href values - Applies to artifact_urls, paper_url, doi_url, and appendix_url fields --- src/assets/js/reprodb-profile-page.js | 13 +++++++++---- src/assets/js/reprodb-search.js | 17 +++++++++++------ 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/src/assets/js/reprodb-profile-page.js b/src/assets/js/reprodb-profile-page.js index 2c05e5d7..2cace61a 100644 --- a/src/assets/js/reprodb-profile-page.js +++ b/src/assets/js/reprodb-profile-page.js @@ -19,6 +19,11 @@ document.getElementById('inst-profile').classList.add('rdb-hidden'); } + function normalizeUrl(u) { + if (u && !u.match(/^https?:\/\//i) && /^10\.\d{4,}\//.test(u)) return 'https://doi.org/' + u; + return u; + } + function availTag(url) { if (!url) return ''; var n = url.replace(/\/+$/, ''); @@ -79,7 +84,7 @@ columns: [ { title: '#', formatter: 'rownum', width: 50, headerSort: false }, { title: 'Title', field: 'title', formatter: function(cell) { - var d = cell.getData(), t = d.title.replace(/\.+$/, ''), u = artifactUrlMap[t] || ''; + var d = cell.getData(), t = d.title.replace(/\.+$/, '').toLowerCase(), u = artifactUrlMap[t] || ''; return (u ? '' + escHtml(d.title) + '' : escHtml(d.title)) + availTag(u); }, headerSort: false }, { title: 'Conference', field: 'conference' }, @@ -246,7 +251,7 @@ (p.papers || []).forEach(function(paper) { if (!paperMap[paper.title]) { var t = paper.title.replace(/\.+$/, ''); - paperMap[paper.title] = { title: paper.title, authors: [], conference: paper.conference, year: paper.year, badges: paper.badges, url: artifactUrlMap[t] || '' }; + paperMap[paper.title] = { title: paper.title, authors: [], conference: paper.conference, year: paper.year, badges: paper.badges, url: artifactUrlMap[t.toLowerCase()] || '' }; } paperMap[paper.title].authors.push(p.name); }); @@ -441,11 +446,11 @@ citedArtifactsMap = res[2] || {}; authorRankHistory = res[3] || []; - // Build artifact URL map + // Build artifact URL map (lowercase keys for case-insensitive lookup) (res[4] || []).forEach(function(a) { var urls = a.artifact_urls || []; var u = urls.length ? urls[0] : (a.artifact_url || a.repository_url || ''); - if (a.title && u) artifactUrlMap[a.title.replace(/\.+$/, '')] = u; + if (a.title && u) artifactUrlMap[a.title.replace(/\.+$/, '').toLowerCase()] = normalizeUrl(u); }); // Build paper index diff --git a/src/assets/js/reprodb-search.js b/src/assets/js/reprodb-search.js index e82bc231..3a5057cf 100644 --- a/src/assets/js/reprodb-search.js +++ b/src/assets/js/reprodb-search.js @@ -20,6 +20,11 @@ var escHtml = ReproDB.escHtml; + function normalizeUrl(u) { + if (u && !u.match(/^https?:\/\//i) && /^10\.\d{4,}\//.test(u)) return 'https://doi.org/' + u; + return u; + } + function normalizeText(s) { return (s || '').toLowerCase().replace(/[^a-z0-9 ]/g, ' '); } @@ -199,8 +204,8 @@ entry.className = 'rdb-result-entry'; // Line 1: Bold title (linked to artifact) - var artUrls = d.artifact_urls || []; - var titleLink = artUrls.length > 0 ? artUrls[0] : (d.repository_url || d.artifact_url || ''); + var artUrls = (d.artifact_urls || []).map(normalizeUrl); + var titleLink = artUrls.length > 0 ? artUrls[0] : normalizeUrl(d.repository_url || d.artifact_url || ''); var titleHtml = titleLink ? '' + escHtml(d.title) + '' : escHtml(d.title); @@ -224,12 +229,12 @@ var links = []; // Paper link: prefer doi_url, fall back to paper_url if (d.doi_url) { - links.push('📄 Paper'); + links.push('📄 Paper'); } else if (d.paper_url) { - links.push('📄 Paper'); + links.push('📄 Paper'); } // Artifact URLs (unified list) - var artUrlList = d.artifact_urls || []; + var artUrlList = artUrls; if (artUrlList.length === 1) { var isGH = artUrlList[0].indexOf('github.com') !== -1; var lbl = isGH ? '💻 GitHub' : '📦 Artifact'; @@ -246,7 +251,7 @@ } }); } - if (d.appendix_url) links.push('📋 Appendix'); + if (d.appendix_url) links.push('📋 Appendix'); var linksLine = links.length > 0 ? links.join(' · ') : ''; entry.innerHTML =