Skip to content

Commit c75b0c2

Browse files
committed
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
1 parent 9dd5dec commit c75b0c2

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

copyparty/web/browser.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6558,6 +6558,7 @@ var thegrid = (function () {
65586558
ohref = esc(ao.getAttribute('href')),
65596559
href = ohref.split('?')[0],
65606560
ext = '',
6561+
ext0 = '',
65616562
name = uricom_dec(vsplit(href)[1]),
65626563
ref = ao.getAttribute('id'),
65636564
isdir = href.endsWith('/'),
@@ -6570,17 +6571,19 @@ var thegrid = (function () {
65706571
ar.shift();
65716572

65726573
ar.reverse();
6574+
ext0 = ar[0];
65736575
for (var b = 0; b < Math.min(2, ar.length); b++) {
65746576
if (ar[b].length > 7)
65756577
break;
65766578

6577-
ext = ar[b] + '.' + ext;
6579+
ext = ext ? (ar[b] + '.' + ext) : ar[b];
65786580
}
6579-
ext = (ext || 'unk.').slice(0, -1);
6581+
if (!ext)
6582+
ext = 'unk';
65806583
}
65816584

6582-
if (use_ext_th && ext_th[ext]) {
6583-
ihref = ext_th[ext];
6585+
if (use_ext_th && (ext_th[ext] || ext_th[ext0])) {
6586+
ihref = ext_th[ext] || ext_th[ext0];
65846587
}
65856588
else if (r.thumbs) {
65866589
ihref = addq(ihref, 'th=' + (have_webp ? 'w' : 'j'));

0 commit comments

Comments
 (0)