From c75b0c25a6397a2620131a798efea7be394cd1ca Mon Sep 17 00:00:00 2001 From: ed Date: Fri, 20 Jun 2025 16:25:30 +0200 Subject: [PATCH] ext-th: reduce specificity (#170); thumbnails defined for file-extension '.asdf' will now also apply to '.qwer.asdf' if no more specific ext-th is given --- copyparty/web/browser.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/copyparty/web/browser.js b/copyparty/web/browser.js index 35fc6707..94555c3c 100644 --- a/copyparty/web/browser.js +++ b/copyparty/web/browser.js @@ -6558,6 +6558,7 @@ var thegrid = (function () { ohref = esc(ao.getAttribute('href')), href = ohref.split('?')[0], ext = '', + ext0 = '', name = uricom_dec(vsplit(href)[1]), ref = ao.getAttribute('id'), isdir = href.endsWith('/'), @@ -6570,17 +6571,19 @@ var thegrid = (function () { ar.shift(); ar.reverse(); + ext0 = ar[0]; for (var b = 0; b < Math.min(2, ar.length); b++) { if (ar[b].length > 7) break; - ext = ar[b] + '.' + ext; + ext = ext ? (ar[b] + '.' + ext) : ar[b]; } - ext = (ext || 'unk.').slice(0, -1); + if (!ext) + ext = 'unk'; } - if (use_ext_th && ext_th[ext]) { - ihref = ext_th[ext]; + if (use_ext_th && (ext_th[ext] || ext_th[ext0])) { + ihref = ext_th[ext] || ext_th[ext0]; } else if (r.thumbs) { ihref = addq(ihref, 'th=' + (have_webp ? 'w' : 'j'));