fix: thumb remove on windows, closes #11357

isekai-main
Barış Soner Uşaklı 2 years ago
parent a3a38e4ba3
commit 767c1d1faf

@ -52,6 +52,7 @@ Thumbs.get = async function (tids) {
const name = path.basename(thumb);
return hasTimestampPrefix.test(name) ? name.slice(14) : name;
})(),
path: thumb,
url: thumb.startsWith('http') ? thumb : path.posix.join(upload_url, thumb),
})));

@ -3,7 +3,7 @@
<div class="alert alert-info">[[modules:thumbs.modal.no-thumbs]]</div>
{{{ end }}}
{{{ each thumbs }}}
<div class="media" data-id="{./id}" data-path="{./url}">
<div class="media" data-id="{./id}" data-path="{./path}">
<div class="media-left">
<img class="media-object" src="{./url}" alt="" />
</div>

@ -82,6 +82,7 @@ describe('Topic thumbs', () => {
assert.deepStrictEqual(thumbs, [{
id: topicObj.topicData.tid,
name: 'test.png',
path: `${relativeThumbPaths[0]}`,
url: `${nconf.get('relative_path')}${nconf.get('upload_url')}${relativeThumbPaths[0]}`,
}]);
});
@ -92,6 +93,7 @@ describe('Topic thumbs', () => {
[{
id: topicObj.topicData.tid,
name: 'test.png',
path: `${relativeThumbPaths[0]}`,
url: `${nconf.get('relative_path')}${nconf.get('upload_url')}${relativeThumbPaths[0]}`,
}],
[],
@ -200,16 +202,19 @@ describe('Topic thumbs', () => {
{
id: tid,
name: 'test.png',
path: relativeThumbPaths[0],
url: `${nconf.get('relative_path')}${nconf.get('upload_url')}${relativeThumbPaths[0]}`,
},
{
id: tid,
name: 'example.org',
path: 'https://example.org',
url: 'https://example.org',
},
{
id: tid,
name: 'test2.png',
path: relativeThumbPaths[1],
url: `${nconf.get('relative_path')}${nconf.get('upload_url')}${relativeThumbPaths[1]}`,
},
]);

Loading…
Cancel
Save