diff --git a/pb_public/status.html b/pb_public/status.html index 46acd4c..4ff61c6 100644 --- a/pb_public/status.html +++ b/pb_public/status.html @@ -706,15 +706,27 @@ function runVerdict(c){ return 'nic nebrání vydání'; } -function shotUrl(r, name){ - var hit = (r.shots || []).filter(function(f){ return f.indexOf(name) === 0; })[0]; +// PocketBase rewrites an uploaded filename: it flattens everything that is not +// a letter or a digit to "_", collapses runs of them, and appends a random +// token. So `signin.happy__home.png` arrives as `signin_happy_home_czik8h4h7b`. +// Matching therefore normalises both sides the same way rather than trusting the +// name to survive -- a prefix match on the raw name found nothing at all. +function normName(s){ + return String(s).toLowerCase().replace(/\.[a-z0-9]+$/, "").replace(/[^a-z0-9]+/g, "_"); +} + +function shotUrl(r, caseId, shotName){ + var want = normName(caseId + "_" + shotName); + var hit = (r.shots || []).filter(function(f){ + return normName(f).indexOf(want) === 0; + })[0]; return hit ? "/api/files/e2e_runs/" + r.id + "/" + hit : null; } function caseRow(r, c){ var shots = (c.evidence || []).filter(function(e){ return e.kind === "screenshot"; }); var pics = shots.map(function(s){ - var u = shotUrl(r, c.id + "__" + s.name); + var u = shotUrl(r, c.id, s.name); return u ? '
' + esc(s.name) + "
" : ""; }).join("");